Compare commits

...

147 Commits

Author SHA1 Message Date
Revanth Kumar Uppala
564ce2a709 rtl8822ce: Remove pr_debug redefinition
Issue: pr_debug is redfined to printk causing unwanted
       log prints in dmesg

Fix: Remove pr_debug redefintion in rtl8822ce driver

Bug 3844473

Change-Id: I4177f8c3fa245a881cd35c206f8d3caa4b811b32
Signed-off-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3121450
Reviewed-by: Amulya Yarlagadda <ayarlagadda@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
2024-04-23 13:25:04 -07:00
Shobek Attupurath
0a0a84577b rtl8822ce: Add Nvidia changes on v5.14.0.4-217
1. Add custom roam parameters
2. Add path for power file
3. Add source tree path for Makefile
4. Add section in Makefile for TEGRA platform
5. Update permissions from 0755 to 0644 for files
6. Move roaming debug prints to RTW_INFO

Bug 4320751
Bug 4556940
Bug 4568390

Change-Id: I842f150781652b3b54949aef8f982903c8d7991e
Signed-off-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Signed-off-by: Shobek Attupurath <sattupurath@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3108666
(cherry picked from commit 4e544f3b3a)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3117398
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
2024-04-18 09:37:17 -07:00
Revanth Kumar Uppala
eacae28123 rtl8822ce: Fix TLP/EAPOL/TXFIFO issues
Issue: Observing the EAPOL packet after a second in 1/10 roams

       Observing TLP Malform packets on SC7

       Observing TXFIFO error when connected to serving AP

       Compilation errors for K6.x

Fix:   Add exact base driver released by realtek with EAPOL/TLP/TXFIFO
       fixes and also resolve some compilation errors.

DRIVERVERSION   v5.14.0.4-217-g7a0377e61.20240410_COEX20240327-2727_beta
BTCOEXVERSION   COEX20240327-2727

Bug 4320751
Bug 4556940
Bug 4568390

Change-Id: Ib02056ea388300dab2364b2bd6ceaf0a2096d3f4
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3115032
(cherry picked from commit ed30eb40ff)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3117396
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Tested-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
2024-04-18 09:37:03 -07:00
Omar Nemri
318fd1fe91 drivers: pva: change kmalloc for kvmalloc for elf
when loading lf, a local buffer is allocated to process the elf.
switch to using kvmalloc from kmalloc to be able to handle memory
pressure situations better.

Bug 4562933

Change-Id: Ie78d2d2a56f13e09e98bf6888ccc76ffb0ecfb12
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3114106
Reviewed-by: Omar Nemri <onemri@nvidia.com>
Tested-by: Omar Nemri <onemri@nvidia.com>
Reviewed-by: Jonas Toelke <jtoelke@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-04-10 16:24:55 -07:00
Jon Hunter
fc8c410eb6 ASoC: tegra: Drop 'oot' suffix for upstream drivers
When booting kernels that have both the upstream and out-of-tree audio
drivers for Tegra present the following errors are observed ...

 Error: Driver 'tegra210-ahub' is already registered, aborting...
 Error: Driver 'tegra210-amx' is already registered, aborting...
 Error: Driver 'tegra186-dspk' is already registered, aborting...
 Error: Driver 'tegra210-mvc' is already registered, aborting...
 Error: Driver 'tegra210-adx' is already registered, aborting...
 Error: Driver 'tegra210-ahub' is already registered, aborting...
 Error: Driver 'tegra210_mixer' is already registered, aborting...
 Error: Driver 'tegra186-asrc' is already registered, aborting...
 Error: Driver 'tegra210-dmic' is already registered, aborting...
 Error: Driver 'tegra210-i2s' is already registered, aborting...
 Error: Driver 'tegra210-admaif' is already registered, aborting...

The problem is that the upstream Tegra audio drivers are loaded first
and then the kernel attempts to load the out-of-tree variants because
they have a different name. The out-of-tree are installed under the
'updates' directory in the file-system and by dropping the 'oot' suffix
from the driver name, then depmod will not attempt to load both variants
of the audio drivers and prioritise loading the drivers in the 'updates'
directory.

Bug 4590647

Change-Id: I6c6fe1eb84bc9fdfa4a8f4abf1ce3a75f3bfba8a
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3110266
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
2024-04-08 13:09:37 -07:00
Omar Nemri
8e77d444fb drivers: pva: use kvzalloc instead of kcalloc
for task pool, kmem buffers, use kvzalloc instead of kcalloc
to better handle memory pressure situations.

Bug 4562933

Change-Id: I015ffa936fe77ab2c914d53667c0ec2f323a0676
Signed-off-by: Omar Nemri <onemri@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3108135
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Colin Tracey <ctracey@nvidia.com>
2024-04-04 17:54:24 -07:00
Jon Hunter
7e82f57b74 nvpps: Add missing header of.h
Building the NVPPS driver with Linux v6.9-rc1 is failing with the
following error ...

 drivers/nvpps/ptp-notifier.c:125:69:
 error: invalid use of undefined type 'const struct device_node'

Add the header file of.h to fix this build issue.

Bug 3826818
Bug 4471899

Change-Id: I0eb23e3556ec280447e3d2c499afc11daad601a0
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3104379
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Paritosh Dixit <paritoshd@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
2024-03-26 07:54:17 -07:00
Hiteshkumar Patel
e77e6c5aec nvidia-oot: nvpps: Replace dev_info with dev_dbg.
nvpps driver is printing debug info when TSC status is not locked.
Replace that status print for dev_info() to dev_dbg().

Bug 4566570

Change-Id: I6537e08204c35698bf11fd9c3ff4951a6167f8e9
Signed-off-by: Hiteshkumar Patel <hiteshkumarg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3101099
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-by: Dipen Patel <dipenp@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-03-25 10:54:28 -07:00
Praveen AC
e3f09d3989 nv_hawk_owl:Fix 3rd Hawk streaming fail.
Enable video pipe line for Hawk3 i.e video pipe 4 & 5.

Bug 4564878

Change-Id: Ib39a5afc332722e5e8476f689a243f7dc71a6a2c
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3099879
Reviewed-by: Narendra Kondapalli <nkondapalli@nvidia.com>
Reviewed-by: Ankur Pawar <ankurp@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Praveen AC <pac@nvidia.com>
Reviewed-by: Praveen AC <pac@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
2024-03-20 04:58:28 -07:00
Shobek Attupurath
9efa10a1d7 rtl8822ce: Move continuous prints to log INFO
Issue: As part of roaming, some debug prints are being continuously
       spewed on kernel logs

Fix: Move roaming debug prints RTW_INFO

Bug 4563642

Change-Id: I7ef8c78241fd6e6c9caf96357a6fb9a6c4b4a555
Signed-off-by: Shobek Attupurath <sattupurath@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3097074
Reviewed-by: Revanth Kumar Uppala <ruppala@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
2024-03-15 11:54:20 -07:00
Hiteshkumar Patel
90c8229157 nvpps: Add support for AGX Orin.
Enable nvpps driver so it can be tested.

- Removed passing of ethernet interface name in DT.
- Require to pass Tegra ethernet controller DT phandle, where PTP server
  will run.

Bug 4489344
Bug 3826818

Change-Id: I943ddf4071a55fb409d589473fde0075ac9f7150
Signed-off-by: Hiteshkumar Patel <hiteshkumarg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3076494
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
2024-03-14 15:39:41 -07:00
Hiteshkumar Patel
755f4a8456 Documentation: update nvpps device tree bindings.
- Add details of register mapping. If we do not pass these details in
  devicetree then it is giving error "TSC memory resource not defined"
  and not able to probe the driver. It is mandatory field for Tegra234.
- Remove hardcoding of ethernet interface name.
- Add to pass DT node for primary and secondary emac node instead of
  interface name.
- Update GPIO details as per refactoring of HTE driver.
- Update example as per update driver and DT node.

Bug 4489344
Bug 3826818

Change-Id: I5edbbe762543289cc2a6225111c5e6250bbabb99
Signed-off-by: Hiteshkumar Patel <hiteshkumarg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3076493
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
2024-03-14 15:39:36 -07:00
Jason Mei
888f248ee2 net: Use conftest to determime NAPI interface
Add compile time tests to the conftest.sh script
to determine netif_napi interface check at compile
time for the kernel being used. This is beneficial
for working with 3rd party Linux kernels that may
have back-ported upstream changes into the kernel
and so the kernel version checks do not work.

Bug 4456727
Bug 4451567

Change-Id: I7b00c3b491d778a9bf2f0d1069a5e4546b722e2a
Signed-off-by: Jason Mei <jianjunm@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3096002
Reviewed-by: svcacv <svcacv@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
2024-03-14 08:54:11 -07:00
Aniruddha Paul
d01b6a3a2b nvethernet: Create pool per Rx DMA channel
Existing implementation uses a single page_pool
for all Rx DMA channels. As by default all irqs
are on CPU 0, this does not cause any issue.
Routing an irq to some other CPU causes race
conditon for page allocation from page_pool which
leads to random memory corruption.

[  158.416637] Call trace:
[  158.416644]  arm_lpae_map_pages+0xb4/0x1e0
[  158.416649]  arm_smmu_map_pages+0x8c/0x160
[  158.416661]  __iommu_map+0xf8/0x2b0
[  158.416677]  iommu_map_atomic+0x58/0xb0
[  158.416683]  __iommu_dma_map+0xac/0x150
[  158.416687]  iommu_dma_map_page+0xf4/0x220
[  158.416690]  dma_map_page_attrs+0x1e8/0x260
[  158.416727]  page_pool_dma_map+0x48/0xd0
[  158.416750]  __page_pool_alloc_pages_slow+0xc4/0x390
[  158.416757]  page_pool_alloc_pages+0x64/0x90
[  158.416762]  ether_padctrl_mii_rx_pins+0x164/0x9d0 [nvethernet]
[  158.416807]  ether_padctrl_mii_rx_pins+0x478/0x9d0 [nvethernet]
[  158.416822]  osi_process_rx_completions+0x284/0x4d0 [nvethernet]
[  158.416832]  0xffffa26218b8f71c
[  158.416855]  __napi_poll+0x48/0x230
[  158.416871]  net_rx_action+0xf4/0x290
[  158.416875]  __do_softirq+0x130/0x3e8
[  158.416889]  __irq_exit_rcu+0xe8/0x110

This change creates a page_pool per Rx DMA channel.
This ensures there is no race conditon for page
alloc/dealloc from each DMA napi context.

Bug 4541158

Change-Id: I12668ee7d824fd30d54a874bbbdf190d02943478
Signed-off-by: Aniruddha Paul <anpaul@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3093534
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
2024-03-14 03:54:09 -07:00
Jon Hunter
003bd8ed9b bmi088: Add build dependency on HTE
The BMI088 driver is dependent upon the HTE driver and so only build the
BMI088 driver if HTE is enabled.

Bug 3961133

Change-Id: I1338d44f4814fb23636206081019ea9cb1390fcc
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3093706
Reviewed-by: Gautham Srinivasan <gauthams@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
2024-03-11 14:54:22 -07:00
Shobek Attupurath
4a31d7ed61 rtl8822ce: Add Nvidia changes
1. Add custom roam parameters
2. Add path for power file
3. Add source tree path for Makefile
4. Add section in Makefile for TEGRA platform
5. Update permissions from 0755 to 0644 for files

Bug 4213654

Change-Id: Ib160d11285c093efe04fc5cb932b770585ad6bb3
Signed-off-by: Shobek Attupurath <sattupurath@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3079869
Reviewed-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-03-09 03:40:00 -08:00
Shobek Attupurath
e3673f6890 rtl8822ce: Add driver with roaming support
Issue: RTL8822CE driver doesn't have active roaming
       support and has issues with current roaming
       algorithm

Fix: Add driver with active roaming enabled and fixes
     issue with 5GHz and BT coex

DRIVERVERSION -
"v5.14.0.4-203-g4a9c85a0f.20240219_COEX20240125-2727_beta"
BTCOEXVERSION -
"COEX20240125-2727"

Bug 4213654

Change-Id: Icff3ece063518575fbcca3d8ea5be0b6314a567f
Signed-off-by: Shobek Attupurath <sattupurath@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3079863
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
2024-03-09 03:39:54 -08:00
Gautham Srinivasan
8317f938ec nvidia-oot: remove gte driver
HTE driver will be used instead of GTE. Remove GTE sources.

Bug 3961133

Change-Id: I379198da9c1896aa44043195a8c30b377b08c7c4
Signed-off-by: Gautham Srinivasan <gauthams@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3067352
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-03-05 19:28:05 -08:00
Gautham Srinivasan
8e5cebeb9e nvidia-oot: nvpps: Use HTE driver
Refactor NVPPS driver to use HTE APIs instead of GTE

Bug 3961133

Change-Id: I0a38fb6fd42217515410a610d1900cb036086cf5
Signed-off-by: Gautham Srinivasan <gauthams@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3067331
Reviewed-by: Dipen Patel <dipenp@nvidia.com>
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-03-05 19:27:59 -08:00
Gautham Srinivasan
cccf65a229 nvidia-oot: bmi088: Use HTE driver
Refactor BMI088 driver to use HTE APIs instead of GTE

Bug 3961133

Change-Id: Idc87574399b5e9d2f907e37b2615ea3d540ceba7
Signed-off-by: Gautham Srinivasan <gauthams@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3062386
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-by: Dipen Patel <dipenp@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-03-05 19:27:54 -08:00
Shubham Chandra
17e0946ce0 nvidia-oot: imx318: fix probe failure
V4l2 ctrl values are 0 during init time s_ctrl call
from v4l2. Since framerate val parameter is 0, when
set_framerate_ex is called from set_ctrl_ex during
initialization for probing of imx318 sensor, this
results in invalid error and probe failure for imx318.

Assign framerate 'val' to a value from imx318 sensor
device-tree properties within the given range to avoid
probe failure due to this.

Bug 3692128

Change-Id: Ib5f50e64f99c8443bf604066eda315dc96fbde03
Signed-off-by: Shubham Chandra <shubhamc@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3089350
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Praveen AC <pac@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-03-05 07:09:09 -08:00
Jon Hunter
f9ed570c2b net: nvethernet: Prevent VM interrupts being balanced
If the userspace service 'irqbalance' is installed then the nvethernet
driver crashes when there is network activity. To avoid this crash set
the IRQF_NOBALANCING flash for the VM interrupts. No performance
degradation is observed when running iperf3 with a 1Gbps link.

Long-term the nvethernet driver still needs to be fixed to allow IRQ
balancing.

Bug 4293378
Bug 4541158

Change-Id: I0aa4ee28e36c7d273f14ff043544e72d3e988bd3
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3087525
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
Reviewed-by: Revanth Kumar Uppala <ruppala@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-03-04 07:24:12 -08:00
Ankur Pawar
4d4e685699 media:i2c: fix imx477 partial frame output
Fix imx477 partial frame issue and wrong frame-length
/exposure time calculations.
Uses hardcoded sensor internal clock frequency
instead of clock values from sensor device tree.

Adding clock frequency to device tree also require
deskew_initial_enable = "true". Setting deskew in
device tree is causing kernel panic in function
nvcsi_deskew_setup(). For unblocking the IMX477
use case, set hardcoded clock in driver for now.

Bug 4384649

Change-Id: Iedb02673c6f4da140aee22adc991805b6aa1eb7e
Signed-off-by: Ankur Pawar <ankurp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3086503
Reviewed-by: Praveen AC <pac@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-03-04 01:24:48 -08:00
Jason Mei
396db89160 PCI: EPF: tvnet: fixed the fence memory issue
1.Make the allocate_fence() thread-safe
2.Update the fence_do_work according to auto
  fix: https://nvbugs/4539983
3.Shouldn't creat fence in callback
4.There was typo which mixed ctrl with data.

Bug 4456727
Bug 4451567

Change-Id: If7676c8d77dc40bd5f77927efa7616e7970da183
Signed-off-by: Jason Mei <jianjunm@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3087944
Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-03-03 20:54:20 -08:00
Anubhav rai
d495adaddf vi5_fops: fix mem leak
release capture requests and embedded data
buffers before closing and exiting the stream

bug 4336756

Change-Id: Iba856eea9757a8226bc949ae1d72a87adf2d55eb
Signed-off-by: Anubhav rai <arai@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3068424
(cherry picked from commit e5075835ab)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3086577
Reviewed-by: Ankur Pawar <ankurp@nvidia.com>
Reviewed-by: Narendra Kondapalli <nkondapalli@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Shubham Chandra <shubhamc@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-03-01 12:57:50 -08:00
Ankur Pawar
7096cb09a5 media:i2c: fix ar1335 control command
When ar1335_common.c was ported to K5.15 it was refactored
based on the review comments. During that process index
in mcu_send_ctrl_cmd() was set to 0xFFFF which was causing
issue in setting sensor format. Pass the index from the
caller of mcu_send_ctrl_cmd().

Bug 4389285

Change-Id: Ic84a8de58051fe947f0f4d6597d1a55bc29ef9e6
Signed-off-by: Ankur Pawar <ankurp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3024535
Reviewed-by: Praveen AC <pac@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-02-26 05:24:23 -08:00
Brad Griffis
f877c7e3da nvidia-oot: Update OOT driver path
The installation path for the OOT drivers has been updated from 'extra'
to 'updates'.

Bug 4410785

Change-Id: I54c8ce97cb1b159095b9dc3450ef0af711eb7f9b
Signed-off-by: Brad Griffis <bgriffis@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3069039
(cherry picked from commit aaee95a8eb)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3082930
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-02-26 03:10:53 -08:00
Jon Hunter
c8a0c93fc1 drivers: Drop '-next' from driver names
The OOT variants of the host1x and tegra-drm drivers originally had
a '-next' suffix in the name to differentiate these from the upstream
versions. Now that the OOT drivers are installed under the 'updates'
directory, the '-next' suffix can be dropped because 'kmod' will
prioritise loading the variant in 'updates' over those built from the
kernel tree.

Bug 4410785

Change-Id: I29287ddb935b681a5ee8a3326428eba82715da76
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3065465
(cherry picked from commit eee13a1edb)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3063836
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-02-26 03:09:59 -08:00
Jason Mei
bba1f3a464 net: ethernet: sync link status before removing
The tegera_tvnet driver usually built as kernel
module, to avoid rmmod/insmod cause kernel crash
sync link status before rmmod

Bug 4456727
Bug 4451567

Change-Id: I2b7227fef36688777b8a468678be9e63a7638c2c
Signed-off-by: Jason Mei <jianjunm@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3079867
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-02-25 21:40:04 -08:00
Jason Mei
3506076764 PCI: EPF: tvnet: porting the PCIe EP tvnet driver
Port the PCIe EP tvnet to 5.15 kernel
switch to host1x sycpt method and others kernel
interfaces

Bug 4456727
Bug 4451567

Change-Id: I78a1ed5e1f80210a03dc83775937ba90c2839a5b
Signed-off-by: Jason Mei <jianjunm@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3070173
Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-02-25 21:39:59 -08:00
Jason Mei
5a65235c0d PCI: EPF: Add lpci_epc_map_addr for pre-v5.15 Linux kernels
Build the Tegra PCI vnet driver fails with Linux v5.14 because the
lpci_epc_map_addr() have the incorrect number of arguments.
The arguments to the lpci_epc_map_addr() functions were updated
in Linux v5.12 but the current Tegra PCI EPF driver assumes that they
were updating after Linux v5.14. Update the Tegra PCI EPF driver to
use the correct arguments for v5.12 onwards.

Bug 4456727
Bug 4451567

Change-Id: Ie4ef36854d380e0a896a0f256d846ab8b89ca447
Signed-off-by: Jason Mei <jianjunm@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3070170
Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-02-25 21:39:54 -08:00
Jason Mei
e70b9e4c10 PCI: EPF: tvnet: porting the PCIe tvnet driver
Port the PCIe tvnet to 5.15 kernel

Bug 4456727
Bug 4451567

Change-Id: I1b7a68479749145eca33361d6c79d53622c57ce7
Signed-off-by: Jason Mei <jianjunm@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3070167
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-02-25 21:39:48 -08:00
Ankur Pawar
29e88ed17e camera: fix the kernel freeze after driver unbind
Kernel freeze is occurring due to incorrect cleanup
in vi5.c.

Fix for kernel freeze:
1 Don't call vi_channel_drv_unregister() and
  tegra_vi_media_controller_cleanup() in vi5_remove.
2 capture_vi_probe() is calling vi_channel_drv_register() and
  tegra_capture_vi_media_controller_init(), so capture_vi_remove()
  should call vi_channel_drv_unregister() and
  tegra_vi_media_controller_cleanup()
3 Use correct dev pointer in vi_channel_drv_unregister().

Code cleanup:
1 Remove use_legacy_path variable that was used for T186.
2 Removed unused t194_vi5_file_private struct.

Bug 4415340

Change-Id: I6153f65d62a9f7f4fc5d04c2ace948a29396e404
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3077660
Reviewed-by: Shubham Chandra <shubhamc@nvidia.com>
Reviewed-by: Ankur Pawar <ankurp@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Ankur Pawar <ankurp@nvidia.com>
2024-02-21 23:10:25 -08:00
Jon Hunter
61319aef4d drm/tegra: Don't print error on probe defer
The following error messages are sometimes observed on boot ...

 tegra-nvjpg 15380000.nvjpg: failed to get icc write handle
 tegra-nvdec 15480000.nvdec: failed to get icc write handle
 tegra-nvjpg 15540000.nvjpg: failed to get icc write handle
 tegra-nvenc 154c0000.nvenc: failed to get icc write handle
 tegra-vic 15340000.vic: failed to get icc write handle
 tegra-nvjpg 15380000.nvjpg: failed to get icc write handle

The above messages are harmless because the ICC core is returning
-EPROBE_DEFER to indicate that the ICC provider is not available. When
-EPROBE_DEFER is returned the kernel will attempt to probe the device
again and so print an error on -EPROBE_DEFER can be misleading. Fix the
above by using the function dev_err_probe() to print error messages
because this function will only print an error message if the error code
is not -EPROBE_DEFER.

Bug 3436156
Bug 4496044

Change-Id: I47b77e5a0f2bdb817a832daa305246c8803f456b
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3075237
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-02-13 02:24:56 -08:00
Praveen AC
518ae94bb4 media: i2c: update ar0234 EEPROM data structure
- Integrate calibration data structure from
  Leopard Imaging hawk driver into NVIDIA
  hawk driver
- Rearrange EEPROM calibration data structure to
  maintain backward compatibility with HAWK, OWL
  modules with EEPROMs programmed using earlier
  calibration data structure
- Use separate structures for tracking imu noise
  parameters and place it after the module
  serial number.
- Change module serial number length used for
  reading the serial number from EEPROM data

L4T-4649

Change-Id: I17613905e63fef3fc690dca42a0a10bd1f4fc24d
Signed-off-by: Praveen AC <pac@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3072846
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-02-09 01:09:27 -08:00
Praveen AC
6642085af9 i2c:nv_hawk_owl: Reduced sensor stream on time.
Following changes are done to reduce 400ms to 200ms:
1> I2c address trans during every power_on is moved to probe time.
   Since with virtual-i2c mux IMUs are handled and hence we don't need to
   do i2c address trans every time. So once during probe time is enough,
   that reduces ~120ms.
2> Reduced sleeping time during start stream call to 20ms, Which reduced
   ~100ms.

Bug 4180672

Change-Id: I027148f64b892d95e5432394f90bf171156ef9c0
Signed-off-by: Praveen AC <pac@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3072821
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: Ankur Pawar <ankurp@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-02-09 01:09:17 -08:00
Praveen AC
e31d73fa20 media: i2c: ar0234: Fix dual hawk corruption
- Fixes the frame corruption issue encountered
  when simultaneously streaming from two
  hawks via E3653 GMSL2 board
- Route each serializer output to a different
  deserializer output CSI port instead of
  routing video data from both serializers
  to the same deserializer output port
- Route data through two virtual channels for
  each of the two output ports instead of four
  virtual channels all through a single output
  port
- Fix serdes programming comments

Bug 4032165
Bug 3753423
JEC-286

Change-Id: I7b4e929e9f5330cc6eb0aa72646ce429a713df7a
Signed-off-by: Praveen AC <pac@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3072829
Reviewed-by: Ankur Pawar <ankurp@nvidia.com>
Reviewed-by: Anubhav Rai <arai@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-02-08 22:54:15 -08:00
Praveen AC
d7f14a85db t23x:P3762: Fix failed to read 2nd Hawk EEPROM serial number.
Changed EEPROM address to 0x15 for 2nd Hawks EEPROM
to avoid fail to read serial number.

Bug 4244937

Change-Id: Ia920ec6464b5bc374289728395da2bceb3f44d39
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3066257
Reviewed-by: Praveen AC <pac@nvidia.com>
Reviewed-by: Anubhav Rai <arai@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Tested-by: Praveen AC <pac@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-02-01 22:39:36 -08:00
Jon Hunter
05b82fc2fe nvhost: Remove legacy NVHOST support
Remove the legacy NVHOST support from the nvhost.h file that is no
longer needed. Eventually we will remove this file completely, but it is
currently still needed as it provides a shim layer for working with the
upstream host1x driver.

Bug 4475969

Change-Id: Id4d97b41de2590800e321e4eeb9c03b434e00dc5
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3065976
(cherry picked from commit 5d2c7b6e3a)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3066026
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-02-01 10:44:27 -08:00
Jon Hunter
b2e0445c73 video: tegra: Remove nvhost and host1x headers
The nvhost.h header in the ISP and VI drivers is a copy of the nvhost.h
header in the main top-level include directory. Remove these and use the
version in the top-level include directory.

Finally, remove the host1x.h header file that is not used at all.

Bug 4475969

Change-Id: I78133231203ee7eb2dc41eee7b8895ba9ce50e02
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3065975
(cherry picked from commit 4c229ee929)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3066025
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-02-01 10:44:22 -08:00
Jon Hunter
34ef06bd12 video: tegra: Don't use nvhost_get_private_data
The function nvhost_get_private_data() is a wrapper around the Linux
platform_get_drvdata() function. To remove all the legacy nvhost code
that is no longer supported or needed, update the camera drivers to use
platform_get_drvdata() directly. Note that there are places in these
drivers that already use platform_get_drvdata() and so this change makes
these drivers more consistent.

Bug 4475969

Change-Id: Ie474c46c438f69c2141f41d0702bf57525597ab5
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3065974
(cherry picked from commit 73a4985dbd)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3066024
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-02-01 10:44:16 -08:00
Jon Hunter
7f293be0be media: camera: Remove of_pwm_n_cells usage
The 'of_pwm_n_cells' has been removed from the pwm_chip structure in the
latest linux-next development branch that will eventually become Linux
v6.9. This parameter was used in function 'of_pwm_xlate_with_flags'.
The camera CDI and ISC drivers don't use the kernel's
of_pwm_xlate_with_flags xlate function and instead implement their own
xlate function. Therefore, it is safe to simply drop the usage of the
'of_pwm_n_cells' parameter completely in these drivers.

Bug 4471899

Change-Id: Id4cf4b7ac182d0654080e536457bab1a7128ad1d
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3063806
(cherry picked from commit 072a881099)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3067933
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-02-01 08:24:16 -08:00
Johnny Liu
246e62b38e video: tegra: remove icc request in system resume
When dla resumes back from system sleep, it should not send any
bandwidth request through ICC framework since it is in idle state.

In the job submit path for dla, nvhost will try to wakeup the device
through nvhost_module_busy, and the associated runtime resume callback
is called in the dla driver. This is the time dla driver should send
bandwidth request to BPMP for bandwidth allocation through ICC
framework.

Bug 4478515

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: Ie4b5cfad6593bd058860ee3be467d6a2384f1b5d
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3067369
Reviewed-by: Rajkumar Kasirajan <rkasirajan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-31 22:24:15 -08:00
Jon Hunter
233a7eb320 drivers: Fix missing headers for Linux v6.8
For Linux v6.8, commit ef175b29a242 ("of: Stop circularly including
of_device.h and of_platform.h") updated the OF headers included by these
header files. This breaks the build for various drivers and so fix this
by including the headers that are actually needed for each driver.

Bug 4448428

Change-Id: Ia40ab13f865d5631c96855ecc49145848f99c996
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3032442
(cherry picked from commit ab65399274)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3063003
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-25 13:55:11 -08:00
Jon Hunter
753583f1e3 misc: mods: Fix headers for Linux v6.8
For Linux v6.8, commit ef175b29a242 ("of: Stop circularly including
of_device.h and of_platform.h") updated the OF headers included by these
header files. This breaks the build for various drivers and so fix this
by including the headers that are actually needed for each driver.

Bug 4448428

Change-Id: Ifb484189524a3ec86aa252e71b4489f4dba5aacd
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3059458
(cherry picked from commit 0899829704)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3063002
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-25 13:55:06 -08:00
Jon Hunter
1ccb6edda2 drivers: Don't use strlcpy()
For Linux v6.8, the function strlcpy() has been removed. The function
strscpy() was added in Linux v4.3 and has been preferred over strlcpy().
See upstream Linux commit 30035e45753b ("string: provide strscpy()") for
more details. The Linux checkpatch.pl script warns against using
strlcpy().

The function strscpy() takes the same arguments as strlcpy(), but
returns a type of ssize_t instead of size_t. Update the drivers to use
strscpy() instead of strlcpy().

Bug 4448428

Change-Id: Id6f196f0e81decf1545f9aa4f74f5c63a7f72a48
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3059457
(cherry picked from commit ecf383265b)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3063000
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-25 13:55:01 -08:00
Anubhav Rai
1b6db0ce3c camera: lt6911uxc update with Shadow EDID
Update the Lontium driver to flash shadow EDID
to lt6911uxc chip. This will ensure that the requested
resolution through the application is flashed to the
chip and the source is forced to select the
requested resolution only.

bug 4266018
bug 4301203
bug 4168489
Signed-off-by: Anubhav Rai <arai@nvidia.com>

Change-Id: I945a9658b52c82956535f3710312d317c0098be7
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3007702
(cherry picked from commit c3ddb23392)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3015613
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-01-23 19:09:34 -08:00
Jon Hunter
26e357d588 misc: mods: Drop DMAENGINE slave_id support
Only Tegra234+ devices are currently supported and for these devices the
only DMA drivers that are supported for Linux are the Tegra210 ADMA and
Tegra186 GPCDMA drivers. Neither of these drivers ever supported the
'slave_id' parameter for configuring the DMA request ID for a given
channel. These drivers have always used device-tree to retrieve this
information. Only the Tegra20 APBDMA controller supported the 'slave_id'
field and this was dropped in Linux v5.17. The Tegra20 APBDMA driver was
supported in Tegra devices up until Tegra210, but starting with Tegra186
it is no longer supported.

Given that this is a legacy feature only supported for legacy Tegra
devices and drivers, drop the 'slave_id' support completely.

Bug 4425688

Change-Id: Id9bb6440805826dfb0cf0d862d6b15fd856e61ff
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3038964
(cherry picked from commit c87f90c7b8)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3058562
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-22 05:11:28 -08:00
Jon Hunter
7635873f3d misc: mods: Fix build when OPTEE is a module
If the Linux kernel driver OPTEE is built as a module (CONFIG_OPTEE=m)
then building the MODS driver for Tegra fails with the following error
...

 drivers/misc/mods/mods_optee.c:22:5:
 error: no previous prototype for 'esc_mods_invoke_optee_ta'
 [-Werror=missing-prototypes]
   22 | int esc_mods_invoke_optee_ta(struct mods_client *client,
      |     ^~~~~~~~~~~~~~~~~~~~~~~~

The problem is in the mods_internal.h file that wraps the prototype for
the above function with '#ifdef CONFIG_OPTEE'. This works fine for when
CONFIG_OPTEE=y but not if CONFIG_OPTEE=m. To ensure that this prototype
is present when the OPTEE driver is built into the kernel or a module,
we need to use '#if IS_ENABLED(CONFIG_OPTEE)'. Update the MODS driver
accordingly to fix this.

Bug 4429280

Change-Id: I48054f60cf26c04d2cacff8d8affc46254020aff
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3038965
(cherry picked from commit 0bd71e49bd)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3055962
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-22 05:11:23 -08:00
Laxman Dewangan
176a1bff8d tegra_hv: Use conftest to find if class_attribute function has const type arg
Determine if struct class_attribute function has const type
"struct class_attribute" argument or not.

Modified the argument by change
commit 75a2d4226b5371 ("driver core: class: mark the struct class
for sysfs callbacks as constant") for Linux 6.3

Bug 4346767

Change-Id: I2a36025b23af80761faf1da406481731289eedd2
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3030734
(cherry picked from commit de4295cfa6)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3059278
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-22 05:10:56 -08:00
Manish Bhardwaj
e997e8ae5a hv: port tegra hypervisor driver on noble kernel
Bug 4377196

Change-Id: Idecaac1915c444fe04c40f0e848e36bd3f90b78f
Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3018492
(cherry picked from commit 912dda68d1)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3059277
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-22 05:10:51 -08:00
Laxman Dewangan
d1c969184b tegra_hv: Use const in class attributes APIs for Linux 6.4 and above
The callback APIs of class attribute are updated on
Linux6.4 and above to have the constant type pointer
argument.

Update the driver compatible with the updated APIs
for Linux 6.4 and above.

Bug 4370594

Change-Id: Ic06cb0d752797bb272f110aa0bb35bdd3afa1e6a
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3013107
(cherry picked from commit c8a83b5692)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3059176
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-22 05:10:46 -08:00
Laxman Dewangan
e02b9efcc4 tegra_hv: Enable driver for Linux 6.2 and above
The driver tegra_hv was disabled for the Linux 6.2 and above
due to build failure. All build issue is fixed and re-enabling
driver for all kernel.

Bug 4370594

Change-Id: I9edef01a4f204b138204d583d9f7f61dc6112a25
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3014191
(cherry picked from commit af936f3b1e)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3059175
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-22 05:10:41 -08:00
Laxman Dewangan
2ac404f410 nvidia-oot: Remove unused CONFIG_TEGRA_IVC_LEGACY_DISABLE
The export of config CONFIG_TEGRA_IVC_LEGACY_DISABLE is
no more required as all drivers which was disabled from
build due to IVC API changes are ported to handle the
new APIs from core kernel.

Remove unused config CONFIG_TEGRA_IVC_LEGACY_DISABLE.

Bug 4346767

Change-Id: I7830f962735b293f9c78cd03acfa1413f9eb4cff
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3033025
(cherry picked from commit 2179242ba9)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3059174
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-22 05:10:36 -08:00
Laxman Dewangan
e7868529f3 misc: Enable build of mods module
Build of mods module disabled due to not supporting legacy IVC
from Linux 6.2.
Enable build of mods.

Bug 4346767

Change-Id: I4eccc831dba2820467f5d455bb5cba387f879b23
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3033023
(cherry picked from commit 00f3315faf)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3038669
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-22 05:10:31 -08:00
Jon Hunter
3f5ba8f70b tty: wch: Fix build for Linux v6.8
In Linux v6.8, the argument for the struct tty_operations::send_xchar
function was updated from char to u8 and this breaks the build for the
'wch' driver. Add a test to the conftest script to detect the argument
type for this function and use the definition generated to fix the build
for the 'wch' driver.

Bug 4448428

Change-Id: I051861cf76e56cacb4b33053d4e6644265552df7
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3057714
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-19 06:39:15 -08:00
Jon Hunter
f1f3771dec conftest: Fix 'type' compile tests
The Conftest Makefile was incorrectly updated changing variable
NV_CONFTEST_TYPE_COMPILE_TESTS to NV_CONFTEST_TYPES_COMPILE_TESTS. Fix
this by correcting the name.

Bug 4346767

Change-Id: Ia34c076526a1ee6870301382e01bfdcc8cd550d3
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3053809
(cherry picked from commit 93360eb080)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3055874
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-01-17 20:39:37 -08:00
Laxman Dewangan
e30e21ebd1 v4l2: Add conftest for v4l2 API changes in Linux 6.6
Add conftest to determine the API changes/deprecation
for V4L2 in Linux6.6. The changes are:
  The device argument is added in the API v4l2_async_nf_init() with
  commit b8ec754ae4c5 ("media: v4l: async: Set v4l2_device and subdev
  in async notifier init") in Linux 6.6.

  The API is removed with commit bda8953e8c3e ("media: v4l: async: Drop
  v4l2_async_nf_parse_fwnode_endpoints()") in Linux 6.6

Bug 4346767

Change-Id: Ia225be8b4fb17003ec2899e872573dc05e9fde87
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3042900
(cherry picked from commit 8df8cfc8e6)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3055495
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Paritosh Dixit <paritoshd@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-17 15:24:14 -08:00
Jon Hunter
ac6a53078b ufs: Remove UFSHCD_QUIRK_ENABLE_STREAM_ID
Remove the legacy downstream quirk 'UFSHCD_QUIRK_ENABLE_STREAM_ID' and
always use the supported upstream quirk from now on. The legacy quirk
will never be upstreamed and so to support 3rd Party Linux distributions
that will not have this quirk, we should only support the official
upstream quirk.

Bug 4346767
Bug 4450187

Change-Id: Iabec6beb63b99ada7e8893cfa2acc0ed5e7ee92f
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3045039
(cherry picked from commit ce916e3f13)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3055492
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
2024-01-17 09:10:08 -08:00
Laxman Dewangan
56c05f8e3f ufs: Use UFS headers directly if it is public header in core kernel
The UFS headers are moved to include as public headers from
Linux 5.19. Use the headers directly from the core kernel
instead of making the copy in drivers-private for nvidia-oot.

Keep copy of only those drivers which are still in the
drivers folder in core kernel.

This will help to align all definition which driver needs to
sync with core driver available in the core kernel.

Bug 4346767

Change-Id: I1e59e32bee0f89591e50fff2f61e35d468f4207c
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3039312
(cherry picked from commit b2dcbdbc93)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3055490
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
2024-01-17 09:10:02 -08:00
Laxman Dewangan
822abd1943 ufs: Port UFS driver to use headers from core kernel for Linux 6.7
Some of the drivers-private headers are now available in public
header path in core kernel. Use such headers directly from the
core kernel for Linux 6.7 and later instead of copying it in the
nvidia-oot/include/driver-private.

Also match the quirks definition with core kernel for Linux 6.0 and
later.

Bug 4346767

Change-Id: If994466a3cabc6df8eeb0e97018f48d48a8306dc
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3038489
(cherry picked from commit dfff2311c3)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3055485
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-01-17 09:09:57 -08:00
Laxman Dewangan
71876127a2 UFS: Port driver-private headers for the Linux 6.7
The headers of UFS got changed for Linux 6.7 over Linux 6.1.
Make the copy the of the headers and modify according to
Linux 6.7 core kernel headers.

Note: These headers will be removed and use directly from
core kernel in follow on cleanups.

Bug 4346767

Change-Id: I12cb4eac187bb3414efcc5bfb6246a322e917094
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3037996
(cherry picked from commit b282d21004)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3055487
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
2024-01-17 09:09:46 -08:00
Jon Hunter
abeacc3534 scsi: ufs: Use conftest for Tegra264
The chip ID for Tegra264 was added in Linux v6.5 and not Linux v6.1 as
indicated in the Tegra UFS driver. Hence, the Tegra UFS driver does not
build against any generic Linux v6.1 to v6.4 kernel. Fix this by using
conftest to determine if the chip ID definition is present in the
kernel.

Bug 4221847

Change-Id: If2ca1202b2a69bf7de36fc327406f1579d2f4969
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3054870
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-01-17 06:54:45 -08:00
Jon Hunter
902712a236 scsi: ufs: Use conftest for suspend differences
In Linux v5.19, the arguments to the 'suspend' function pointer defined
in the structure 'ufs_hba_variant_ops' was updated to add a 'status'
argument. Add a new test to the conftest script that checks if the
'suspend' function has a 'status' argument and use the definition
created by conftest to select which structure member is used.

This is beneficial for working with 3rd party Linux kernels that may
have back-ported upstream changes into their kernel and so the kernel
version checks do not work.

Bug 4221847

Change-Id: I05011a4a1aff7c54cd258147d6519b696904a2de
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2996214
(cherry picked from commit f748f0ef72)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3032086
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-01-17 06:54:34 -08:00
Jon Hunter
ff6f3c6916 scsi: ufs: Clean-up headers
Clean-up the UFS headers by adding a new top-level header for ufshcd.h,
ufshci.h and unipro.h that will include the appropriate header
depending on kernel version. This saves replicating the kernel version
check for every source file that includes these headers.

Note that the ufshcd-pltfrm.h header is identical between v5.15, v5.16
and 6.1 kernels and so remove the duplicated versions of this header and
just use a common header for all kernel versions.

Bug 4221847

Change-Id: I0e0ba2f4389af7e34ab62e3131141405d87aeeb1
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2996211
(cherry picked from commit 54e01347ea)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3031885
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-17 06:54:24 -08:00
Jon Hunter
11e0abc8a3 media: camera: Fix build for Linux v6.8
In Linux v6.8, the 'g_frame_interval' function pointer was removed from
the 'v4l2_subdev_video_ops' structure and replaced by
'get_frame_interval' that was added to the 'v4l2_subdev_pad_ops'
structure. Add a test to conftest to detect if 'get_frame_interval' is
supported and update the camera CSI driver accordingly to populate the
appropriate function pointer.

Note that the new 'get_frame_interval' function pointer has an
additional 'state' argument but is otherwise the same as the previous
'g_frame_interval' function pointer.

Bug 4448428

Change-Id: Iff049c3bffda11c677ac879b2b91e10deb78060c
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3053901
(cherry picked from commit a1f59dfc30)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3055255
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-17 04:40:24 -08:00
Jon Hunter
5d31085674 net: nvethernet: Fix build for Linux v6.8
The ethtool_ops function pointers get_rxfh and set_rxfh were updated for
Linux v6.8 to pass arguments via a new 'ethtool_rxfh_param' structure.
Add a new test for conftest to detect if the get_rxfh and set_rxfh
functions support the 'ethtool_rxfh_param' structure and update the
nvethernet driver accordingly for Linux v6.8.

Bug 4448428

Change-Id: Ia1c49d88c4ac73539454b010af92c261e14be4bf
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3037949
(cherry picked from commit 0356a563b3)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3055254
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-17 04:40:20 -08:00
Jon Hunter
a86b3af506 drivers: pwm: Fix build for Linux v6.8
Commit 54c86dd20bba ("pwm: Replace PWM chip unique base by unique ID")
removed the 'base' field of the 'pwm_chip' structure replacing it with
an 'id' field. The new 'id' is initialised by the PWM driver core and
does not need to be configured by the PWM drivers.

Add a test for conftest to detect if the 'pwm_chip' structure has the
'base' field and update the various PWM driver to only set this field if
present.

Bug 4448428

Change-Id: I7cf466eddba4aedb57db84534e3cbf99be64151e
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3027486
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
(cherry picked from commit 10fd025187)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3055253
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-17 04:40:15 -08:00
Jon Hunter
32f23c8ab2 gpu/drm: tegra: Fix build for Linux v6.8
Building the Tegra DRM driver with Linux v6.8 fails with the following
error ...

 drivers/gpu/drm/tegra/hdmi.c:623:25: error: implicit declaration of
 function ‘drm_eld_size’; did you mean ‘mm_cid_size’?
 [-Werror=implicit-function-declaration]
  623 |    size_t length = drm_eld_size(hdmi->output.connector.eld), i;
      |                    ^~~~~~~~~~~~

Commit ("8eb80946ab0c drm/edid: split out drm_eld.h from drm_edid.h")
added the header file 'drm/drm_eld.h' which now needs to be included to
build the Tegra DRM driver. Fix the build issue by using conftest to
detect the presence of the header 'drm/drm_eld.h' and include this
header if present.

Bug 4448428

Change-Id: Ifb17648d1dc721e1f0de3f864f4cc76450eea394
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3027485
(cherry picked from commit 8d5286c379)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3055252
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-17 04:40:10 -08:00
Laxman Dewangan
259736545b crypto: Enable few of crypto driver for Linux6.6
Enable crypto drivers which are getting build properly
with Linux 6.6 and keep disabling the compilation of
build failed drivers.

Bug 4346767

Change-Id: Ia5c67759b6c839a874ea9e38d601c722596e0008
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3010492
(cherry picked from commit 9b0b059027)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3053821
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-16 14:56:09 -08:00
Bitan Biswas
34fd7d68dc crypto: fix crypto_engine_ctx build error
struct crypto_engine_ctx removed in k6.6 hence use
conftest helper based macro to select updated data types

Bug 4346767

Change-Id: I2c00f99251e90f0dd3641703ba24a2a8ac23e927
Signed-off-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2994021
(cherry picked from commit 48e59e9d42)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3053820
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-16 14:56:04 -08:00
Bitan Biswas
4a32aa94e5 crypto: conftest struct crypto_engine_ctx support
struct crypto_engine_ctx removed in k6.6 hence use
conftest helper based macro to select updated data types

Bug 4346767

Change-Id: I23e8f054719f399877b11f42d355f940d8e07186
Signed-off-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3026513
(cherry picked from commit 2a9ce8d0e2)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3053713
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-01-16 14:55:59 -08:00
Bitan Biswas
e4d4103ebe nvidia-oot: enable noble crypto
Enable crypto build with noble

Change-Id: Ib4ab440fdd75a3663c717992c3c80eae1fe77f88
Signed-off-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3011180
(cherry picked from commit b185ee48be)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3053822
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-16 14:55:49 -08:00
Laxman Dewangan
7abc2d8726 camera: vi: Use proper APIs from v4l2 for Linux6.6
The earlier porting of the driver for Linux 6.6 is not
matching with the previous kernel implementation.

Few V4L2 APIs have been deprecated from Linux 6.6. and
added the new APIs.

Use the correct API available from Linux6.6 for the
replacement as the previous supported kernel APIs.

For reference, the changes in core kernels are:
  The device argument is added in the API v4l2_async_nf_init() with
  commit b8ec754ae4c5 ("media: v4l: async: Set v4l2_device and subdev
  in async notifier init") in Linux 6.6.

  The API is removed with commit bda8953e8c3e ("media: v4l: async: Drop
  v4l2_async_nf_parse_fwnode_endpoints()") in Linux 6.6

Bug 4346767

Change-Id: I94877a8fe6a6764fc3c913fea7ecdbfdc7c793d6
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3042993
(cherry picked from commit 7d931ef33d)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3053710
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-16 14:55:44 -08:00
Laxman Dewangan
f8e977a8c9 camera: Use conftest to find if v4l2_async_notifier_* present
use conftest to determine if APIs v4l2_async_notifier_*()
present or not.
These APIs have been renamed in
commit 3c8c15391481 ("media: v4l: async: Rename async
nf functions, clean up long lines") in Linux 5.16

Bug 4387902

Change-Id: Id2023543f487c3867ef4e140662141803ac63f04
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3037918
(cherry picked from commit 702def895c)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3053709
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-01-16 14:55:39 -08:00
Laxman Dewangan
1f0954f43d media: Use conftest to find if v4l2_async_subdev_nf_init() present
Use conftest to find if function v4l2_async_subdev_nf_init() is present
or not.

In Linux 6.5, with change commit bda8953e8c3e7e ("media: v4l: async:
Drop v4l2_async_nf_parse_fwnode_endpoints()"), added the function
v4l2_async_subdev_nf_init() and dropped v4l2_async_nf_init().

Bug 4346767

Change-Id: I345db2acf0a07d05722611d9eacc7134aff0c35a
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3028766
(cherry picked from commit 3839cecd1c)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3053708
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-01-16 14:55:29 -08:00
Laxman Dewangan
711d4aee8d media: Use conftest to find if enum v4l2_async_match_type present
Use conftest to determine if the 'enum v4l2_async_match_type'
has the "TYPE" in its name.

In Linux 6.5, with change commit 7a2259fc5182b ("media: v4l: async:
Rename V4L2_ASYNC_MATCH_ macros, add TYPE_"), the enum names has "TYPE" also.

Bug 4346767

Change-Id: I863da8496337d4003188b654673c67cdb3eef155
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3028745
(cherry picked from commit 5f77d6d51a)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3053707
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-01-16 14:55:19 -08:00
Laxman Dewangan
afe9bdc7c0 media: Use conftest to find if struct v4l2_async_connection present
Use conftest to find if struct v4l2_async_connection present
or not. The struct v4l2_async_subdev is renamed to struct
v4l2_async_connection with change commit adb2dcd5f2d49d3
("media: v4l: async: Rename v4l2_async_subdev as v4l2_async_connection")
in Linux 6.5

Bug 4346767

Change-Id: Id15c8ce747a8642b7831b79f45e15f26e95744b2
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3028744
(cherry picked from commit 234ba9c75f)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3053706
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-01-16 14:55:08 -08:00
Laxman Dewangan
5b4a093e24 i2c: Use conftest to find return type of .remove of i2c_driver struct
Use conftest to determine the return type of .remove() of
struct i2c_driver is int or void type instead of kernel version.

The return type got changed with commmit ed5c2f5fd10d ("i2c:
Make remove callback return void")

Bug 4387902

Change-Id: Id64466613156e0efaf6cce7492d70cab1c1d1af7
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3036799
(cherry picked from commit 1eab65044c)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3053705
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-16 06:39:23 -08:00
Laxman Dewangan
14abda2794 i2c: Use conftest to find if i2c driver probe has i2c_device_i2d arg
Determine if probe of struct i2c_driver has i2c_device_id argument
or not.

This argument get removed from commit 03c835f498b5 ("i2c: Switch
.probe() to not take an id parameter") form Linux 6.3.

Bug 4346767

Change-Id: Ife73b29946246fce5bfcedcabe15992432d86348
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3030809
(cherry picked from commit 2884c4b380)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3054211
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-16 06:39:18 -08:00
Laxman Dewangan
6ad6325734 i2c: Use conftest to find if i2c_driver struct has new_probe
Use conftest method to find if i2c_driver struct has the
member as new_probe. This is dropped from Linux 6.6 with
commit 5eb1e6e459cf ("i2c: Drop legacy callback .probe_new()")

Bug 4346767

Change-Id: I10b539dfa1bb363ad6cf5fc28a9ebd0ca4e88b48
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3028631
(cherry picked from commit 537a307ffd)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3053704
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
2024-01-16 02:10:25 -08:00
Laxman Dewangan
a39a2be24e serial: Use conftest to find if uart_ops has set_termios has const arg
Use conftest to determine if set_termios of struct uart_ops
has const type argument or not. The argument type is changed
from commit bec5b814d46c ("serial: Make ->set_termios() old
ktermios const") in Linux 6.1

Bug 4387902

Change-Id: I175aac51ac2c2b99b9eedc69260ccb6b0c38571e
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3037040
(cherry picked from commit 32516f4878)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3053703
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
2024-01-16 02:10:18 -08:00
Laxman Dewangan
9c2c4a695c tty: Use conftest to find if tty_operations::write() has argument u8 ptr
Use conftest to find if the function write() of tty_operations
struct has the argument as U8 pointer data type. This datatype
is changed from Linux 6.5 with commit 69851e4ab8feeb ("tty:
propagate u8 data to tty_operations::write()")

Bug 4346767

Change-Id: I49f9ef844da0dee8e209e597989f1d179a2a804b
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3028632
(cherry picked from commit a757343f2e)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3053702
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
2024-01-16 02:10:13 -08:00
Laxman Dewangan
3a35e1c2b1 sound: Use conftest to find if snd_soc_dai_ops has probe callback
Use conftest to find if struct snd_soc_dai_ops have the probe()
callback or not. In Linux 6.5, commit 516ee7009ff20 ("ASoC:
tegra: merge DAI call back functions into ops") added probe()
callback into the struct snd_soc_dai_ops.

Bug 4346767

Change-Id: If292f10d6e52a2cf80c7700ff7aba5805041531f
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3028743
(cherry picked from commit 350a86106e)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3053701
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-16 02:10:08 -08:00
Laxman Dewangan
0d940461d4 media: {cdi,is}_gpio: Initialize parent dev for gpio chip
Set the parent node of the gc to the gpio device so that
core will get the of_node of device from parent node.

Bug 4387902

Change-Id: I795e612c11bdf72067b85d23ce5914abdcc3c139
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3052126
(cherry picked from commit d09293e954)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3053104
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-15 23:55:00 -08:00
Jon Hunter
e3fc979712 camera: Fix build when CONFIG_MEDIA_SUPPORT is not enabled
Some camera drivers are dependent upon CONFIG_MEDIA_SUPPORT being
enabled in the kernel and if it is not enabled, building these drivers
fail. Fix this by only building the camera drivers dependent upon
CONFIG_MEDIA_SUPPORT when this option is actually enabled.

Bug 4449072

Change-Id: I3637b5763667fbc9965bbeaf126115010e711c7e
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3050559
(cherry picked from commit 9de3e799ae)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3053101
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-15 23:54:55 -08:00
Laxman Dewangan
e3f7ab90e1 rtcpu: capture-ivc: Enable build for Linux 6.2
The driver of rtcpu/capture-ivc is modified to support
the new APIs of the IVC from core kernel using conftest.

Enable build of this driver.

Bug 4346767

Change-Id: I427bb8b7d5dad02e805d0707fb67e45772fead31
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3033024
(cherry picked from commit bf1cfb5fb4)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3053700
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
2024-01-15 23:54:46 -08:00
Laxman Dewangan
2fc926c8fe firmware: bpmp-tegra186-hv: Enable build for Linux 6.2
The build of bpmp-tegra186-hv was disabled due to change
in core kernel to move the Tegra BPMP IVC to IOSYS-MAP
framework by commit 4c1e0a97351a5e ("firmware: tegra:
bpmp: Use iosys-map helpers") in Linux 6.1.

Bug 4346767

Change-Id: I704ef454192613ade8e97f708e997fa74a186b7b
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3031778
(cherry picked from commit 1fc6fc17f2)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3038670
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
2024-01-15 23:54:41 -08:00
Jon Hunter
f7d42ed1c4 media: i2c: Fix build for GCC 6/7
Building nv_ar0234 and nv_hawk_owl sensor drivers with GCC 6/7 fails
with the following errors ...

 drivers/media/i2c/nv_ar0234.c:797:66: error: initialiser element is not
 constant
 .compound_ctrl_size = {sizeof(struct NvCamSyncSensorCalibData),
                        alternating_exposure_cfg_size},
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 drivers/media/i2c/nv_hawk_owl.c:883:59: error: initialiser element is
 not constant
 .compound_ctrl_size = {sizeof(NvCamSyncSensorCalibData),
                        alternating_exposure_cfg_size},
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

These older versions of GCC are not able to reconcile the size from the
variable 'alternating_exposure_cfg_size' even though it is defined as
const. Given that the variable 'alternating_exposure_cfg_size' is only
used here, fix this by removing this variable and directly defining the
size in the declaration of the 'compound_ctrl_size' parameter.

Note that the minimum GCC compiler currently supported by the Linux
kernel is v5.1.

Bug 4448563

Change-Id: I4d3ac6eeb961a944901e73a1d92e753cae44220c
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3050272
(cherry picked from commit 8b3ebff940)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3051959
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-14 15:24:13 -08:00
Laxman Dewangan
560b7c1345 Makefile: Remove CONFIG_TEGRA_GPIO_LEGACY_DISABLE
Remove config CONFIG_TEGRA_GPIO_LEGACY_DISABLE which
was added to avoid the build of few modules due to
API changes in core kernel from Linux 6.2.

ALl modules drivers are updated to support the Linux 6.2
and above.

Bug 4346767

Change-Id: I81c56eda77bfb42f56f01216c721f410dac39d77
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3031555
(cherry picked from commit e290576b47)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3051590
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-14 13:09:30 -08:00
Laxman Dewangan
e94f3bb6d8 {isc,cdi}_mgr: Use gpiod_count() for getting number of GPIO
The API gpiod_count() returns the number of the GPIO in given
property. This API is supported from long and continue to
support.

Use this API instead of of_gpio_named_count() which is deprecated
from Linux 6.2.

Bug 4387902

Change-Id: I2b647b8645e0dd8ff743515ac999fe035e636dc5
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3035503
(cherry picked from commit 6627276f82)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3051588
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-01-14 13:09:25 -08:00
Laxman Dewangan
82f8d2b998 bludroid_pm: Enable build of driver with Linux6.2
The build of driver is disabled from Linux 6.2 due to
changes in core kernel where API of_get_named_gpio_flags()
has been removed.

This APIS is removed in commit 40fc56ee608cdb ("gpiolib:
of: remove of_get_gpio[_flags]() and of_get_named_gpio_flags()")
in Linux 6.2.

Add support to use the new APIs for Linux 6.2 onwards.

Bug 4346767

Change-Id: I573c13398945db93d2a3a3db81bfd53f1be159f6
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
(cherry picked from commit f777618023)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3050579
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-01-12 20:24:19 -08:00
Laxman Dewangan
b27e2e49de cdi_gpio: Enable build of cdi_gpio for Linux 6.2
The build of cdi_gpio driver was disabled for Linux 6.2
as there is change in API in core kernel.

Enable build of cdi_gpio driver with appropriate
modification in driver for Linux 6.2.

Bug 4346767

Change-Id: If2d67a87a37bb868b217346d0dbfb5d56e4617e1
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3031552
(cherry picked from commit 6fcf226b96)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3051583
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
2024-01-12 18:24:43 -08:00
Laxman Dewangan
a6fc43ecb8 cdi_mgr: Enable build of cdi_mgr for Linux 6.2
The build of cdi_mgr driver was disabled for Linux 6.2
as there is change in API in core kernel.

Enable build of cdi_mgr driver with appropriate modification
in driver for Linux 6.2.

Bug 4346767

Change-Id: I6315482b593926e1382a0ffc9ca8aa9a27740d11
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3031551
(cherry picked from commit 9174561352)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3051589
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
2024-01-12 18:24:38 -08:00
Laxman Dewangan
c61a3c670f isc_gpio: Enable build of isc_gpio for Linux 6.2
The build of isc_gpio driver was disabled for Linux 6.2
as there is change in API in core kernel.

Enable build of isc_gpio driver with appropriate
modification in driver for Linux 6.2.

Bug 4346767

Change-Id: Id520231dcfb2daa8efeb9eeb8db8d7d18c7ecb74
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3031554
(cherry picked from commit 103ebd91bc)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3051587
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
2024-01-12 18:24:32 -08:00
Laxman Dewangan
ce24d01296 isc_mgr: Enable build of isc_mgr for Linux 6.2
The build of isc_mgr driver was disabled for Linux 6.2
as there is change in API in core kernel.

Enable build of isc_mgr driver with appropriate modification
in driver for Linux 6.2.

Bug 4346767

Change-Id: Ieb7d55d6068d1d893fcc8bfac7aa71c2ba1dece9
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3031553
(cherry picked from commit c94946a0bb)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3051586
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
2024-01-12 18:24:27 -08:00
Laxman Dewangan
a77844b17d conftest: Add test to find if gpiochip_add() present
Add conftest  Determine if function gpiochip_find()
present or not.

The function gpiochip_find() is removed from
commit 2654521d774f9 ("gpiolib: remove
gpiochip_find()") in Linux 6.7

Bug 4346767

Change-Id: I5b7c4b87c327ac69c8ff735940d086352665de2f
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3031549
(cherry picked from commit 3e87d0a8ea)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3051582
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-01-12 13:25:15 -08:00
Laxman Dewangan
cef95180b3 conftest: Add test to find if struct gpio_chip has of_node
Determine if struct gpio_chip has the of_node member or not.

The of_node from struct gpio_chip is removed from
commit 70d0fc4288dab ("gpiolib: Get rid of not
used of_node member") in Linux 6.2

Bug 4346767

Change-Id: I5ebc86beb7ce527f2e38693dd59907cdd3a8fcf9
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3031548
(cherry picked from commit 05cf355367)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3051581
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-01-12 13:25:04 -08:00
Laxman Dewangan
c0beaa46b5 conftest: Add test to find of_gpio_named_count()
Add conftest to find if of_gpio_named_count()
function is present.

This APIS is removed in commit c7835652a85df ("gpiolib: of: stop
exporting of_gpio_named_count()") in Linux 6.2.

Bug 4346767

Change-Id: Ia8339a4f0c7bfcbeed922c7045330ae2ba83f96c
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3031547
(cherry picked from commit 5f188c61f5)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3051585
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-01-12 13:24:52 -08:00
Laxman Dewangan
9bfb2e35b7 conftest: Add test to find of_get_named_gpio_flags()
Add test to find out if of_get_named_gpio_flags() present
or not.

This APIS is removed in commit 40fc56ee608cdb ("gpiolib:
of: remove of_get_gpio[_flags]() and of_get_named_gpio_flags()")
in Linux 6.2.

Bug 4346767

Change-Id: I522097bdeb5fbd5a545b981a1a9b3f6f7ecb2806
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
(cherry picked from commit f78f96de71)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3051580
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2024-01-12 13:24:42 -08:00
Jon Hunter
11670f570d spi: Fix build for Linux v6.8
For Linux v6.8, support for SPI controllers with multiple chip-selects
was added to the SPI core and this updated the 'chip_select' member of
the 'spi_device' structure to be an array. This breaks building the
Tegra124 SPI Slave driver and Tegra210 QUAD SPI driver.

A helper function, spi_get_chipselect(), was added for Linux v6.3 to
retrieve the chip-select for a SPI device and can be used for retrieving
the chip-select for all Linux v6.3+ kernels.

Add a conftest rule to detecting if spi_get_chipselect() is present and
if so use this for getting the chip-select. This fixes the build issues
for Linux v6.8.

Bug 4448428

Change-Id: Ia4f95ed96b9a18cc7da7a4a52305fc64bc31905c
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3050146
(cherry picked from commit 9e2f7ecdf7)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3051189
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2024-01-12 02:37:51 -08:00
Laxman Dewangan
f255a170a7 nvmap: Use conftest to finding shrinker_alloc() presence
Use conftest to find whether shrinker_alloc() is present
or not.
In Linux v6.7, commit c42d50aefd17 ("mm: shrinker: add infrastructure for
dynamically allocating shrinker") added this API.

Bug 4346767

Change-Id: Ida724bb31d3c4db650b3a5742c5972f984cb9152
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3028574
(cherry picked from commit 3b457a1293)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3036795
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-12-19 03:39:49 -08:00
Jon Hunter
020bdeded8 media: camera: Use conftest for devnode
Use confest in the camera CDI and ISC drivers to determine if the
'devnode' function pointer under the class structure to take a const
device struct.

Also fix the commit in conftest that introduced the change to the
'devnode' function pointer.

Bug 4346767

Change-Id: I66de39e079c13219e0ff3e7154c0e7ceb609a29d
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3034763
(cherry picked from commit 891d093a76)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3037031
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-12-18 19:09:38 -08:00
Jon Hunter
e1471516b0 media: camera: Remove devm_fwnode_get_gpiod_from_child
The function devm_fwnode_get_gpiod_from_child() was removed in Linux
v6.2. This function has always called devm_fwnode_gpiod_get_index() and
this was first introduced in Linux v5.5. Therefore, remove
devm_fwnode_get_gpiod_from_child() and always use
devm_fwnode_gpiod_get_index().

Bug 4346767

Change-Id: Ie94a20ffda67569962fa48d7104c8ff706be079d
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3034777
(cherry picked from commit 75c908beb6)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3037030
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
2023-12-18 19:09:27 -08:00
Laxman Dewangan
0ca520ee30 nvmap: dynamically allocate nvmap page pool shrinker
Dynamically allocate the nvmpa pagepool shrinker as
shrinker register and unregister get removed from
Linux 6.7.

Based on change:
***
commit 86298d8b8ceacc17d0192cd6412d2773ff51b27f
Author: Qi Zheng <zhengqi.arch@bytedance.com>

    md/raid5: dynamically allocate the md-raid5 shrinker
***

Bug 4346767

Change-Id: Idbe40753f79481d85e5899d2905039860d39dc5e
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3020001
(cherry picked from commit fc748158cc)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3036794
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-18 09:11:48 -08:00
Laxman Dewangan
6b290b7f84 nvmap: Use conftest to find get_rcu_file() argument type
The argument of get_rcu_file() get changed to pointer
type of file handle form Linux 6.7 with
commit 0ede61d8589cc ("file: convert to SLAB_TYPESAFE_BY_RCU").

Use conftest to findout this new argument type.

Bug 4346767

Change-Id: I18943421dd4c2ed4f409ce071b182e68d3d393e6
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3028575
(cherry picked from commit ed5ae591c9)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3036792
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-18 09:11:43 -08:00
Laxman Dewangan
b5178e70d8 nvmap: Pass proper argument for get_file_rcu() for Linux 6.7
The function get_file_rcu() has modification in its
argument to take the pointer to pointer of file from
Linux 6.7 from below change
***
commit 0ede61d8589cc2d93aa78230d74ac58b5b8d0244
Author: Christian Brauner <brauner@kernel.org>

    file: convert to SLAB_TYPESAFE_BY_RCU
***

Add support for Linux 6.7.

Bug 4346767

Change-Id: I1e2e005900c7d2c57ac487b5f6ac5e1fcbfbafe7
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3020000
(cherry picked from commit 4ef0a332e8)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3036791
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-18 09:11:39 -08:00
Laxman Dewangan
efbbf91f79 pwm: Use conftest to findout if pwm_ops has owner
Use conftest method to find out the pwm_ops has
owner member or not. The owner member from pwm_ops
struct has been removed from Linux 6.7 with
commit 384461abcab6 ("pwm: Manage owner assignment
implicitly for drivers").

Bug 4346767

Change-Id: I7b98463b16d400a656a79db3a0c7aa645f20085d
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3028573
(cherry picked from commit b0bfc4b801)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3030107
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-18 09:11:34 -08:00
Laxman Dewangan
29ab9b19c9 sound: Use conftest to find if snd_soc_xxx() present
In Linux 6.7, with change
commit 1d5a2b5dd0a8d2b2 ("ASoC: soc.h: convert asoc_xxx() to snd_soc_xxx()")
asoc_xxx() calls are replaced by snd_soc_xxx() calls.

Use conftest to findout this change.

Bug 4346767

Change-Id: I8cd5ac5a5befa83c139dbf8f6253840a97c1d4be
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3028577
(cherry picked from commit e225408ff7)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3036789
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-18 09:11:29 -08:00
Laxman Dewangan
1432eb248d sound: soc: Use conftest to find if asoc_simple_xxx renamed
In Linux v6.7, commit b5a95c5bf6d69 ("ASoC: simple_card_utils.h: convert
not to use asoc_xxx()") add new APIs to convert asoc_simple_xxx() to
simple_util_xxx().

Use the conftest to find if soc_snd_util_xxx() present.

Bug 4346767

Change-Id: I3b282eb08d51c997760cc0b9752438c94e3caae5
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3028578
(cherry picked from commit 3013b107c1)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3036788
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-18 09:11:25 -08:00
Laxman Dewangan
4ab98ef641 sound: soc: Avoid uses of asoc_xxx()
From Linux 6.7, the asoc_xxx() is replaced by the various
function. Use the appropriate functions.

***
commit 1d5a2b5dd0a8d2b2b535b5266699429dbd48e62f
Author: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

    ASoC: soc.h: convert asoc_xxx() to snd_soc_xxx()

Author: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

    ASoC: simple_card_utils.h: convert not to use asoc_xxx()

***

Bug 4346767

Change-Id: Ie3945f3997d745df8223fd31c1386a3db44e6ceb
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3019997
(cherry picked from commit 36d1775879)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3036787
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-18 09:11:20 -08:00
Laxman Dewangan
7f9beef481 dce: Use kstrtobool instead of strtobool
The function strtobool() is implemented inline with
using kstrtobool(). The function strtobool() is removed
from mainline Linux 6.7 with below change.

**
commit 9bf2850c9170b52a6ab052085feced55effa78ef
Author: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

    kstrtox: remove strtobool()
**

Use the kstrtobool() now.

Bug 4346767

Change-Id: I3b63684bcfc5621a3833b62061ea1cfdf44b3865
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3019996
(cherry picked from commit 1d4285fa30)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3036786
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-18 09:11:15 -08:00
Jon Hunter
069d6bb3eb drivers: Enable -Wmissing-prototypes
The compiler option -Wmissing-prototypes is being enabled globally in
the upstream Linux kernel and this causes build failures for various
drivers. The build failures occur because either the driver is missing
an include file which has the prototype or because the function is not
declared statically when it should be (ie. there are no external users).

Fix the various build failures and enable -Wmissing-prototypes to
prevent any new instances from occurring. Note that the only driver that
is not fixed at the moment is rtl8822ce due to large number of failures
and so build this with '-Wno-missing-prototypes' for now, which is not
different to how it was being compiled prior to this change.

Bug 4404965

Change-Id: Ie5572d23659e0346fa035d645d9043b0a6da5fdc
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3027488
(cherry picked from commit d5391a25ab)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3034644
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-18 09:11:10 -08:00
Laxman Dewangan
7f3751f642 nvadsp: os: Fix the argument of iommu_map() for Linux 6.3
There is additional argument added in iommu_map() from Linux6.3.
Pass the proper argument from the drier who are using this
APIs. Using conftest methods for differentiating whether
additional argument is needed or not.

Bug 4374520

Change-Id: I0844beb3338a2d5237832867547d05da91a41a5f
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
(cherry picked from commit c8262cbee1)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3035519
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-18 09:11:06 -08:00
Laxman Dewangan
e91b43420c drm/tegra: Use conftest for drm_debugfs_remove_files()
The function drm_debugfs_remove_file() has extra argument in
Linux 6.7 with change commit 8e455145d8f16 ("drm/debugfs: rework
drm_debugfs_create_files implementation v2")

Use conftest to findout this new argument presence.

Bug 4346767

Change-Id: I77346a85c8841f915f4a8f3f471af1e03240fa62
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3028576
(cherry picked from commit 1ae406004f)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3031239
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-18 09:11:01 -08:00
Laxman Dewangan
5b6fed0199 gpu: drm: Add root argument on drm_debugfs_remove_files() for Linux 6.7
Add root argument in the call drm_debugfs_remove_files() for Linux 6.7
as per below change from mainline:

***
commit 8e455145d8f163aefa6b9cc29478e0a9f82276e6
Author: Christian König <ckoenig.leichtzumerken@gmail.com>

    drm/debugfs: rework drm_debugfs_create_files implementation v2
***

Bug 4346767

Change-Id: Iadc878d66b093fd72b4524052dee9dbb24e82c1d
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3019998
(cherry picked from commit b17be80108)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3031427
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-18 09:10:56 -08:00
Jon Hunter
7c4bfe82b2 misc: bluedroid: Use conftest for pde_data
Conftest has a test for checking if the 'pde_data' function is lower
or upper case. Update the bluedroid driver to use conftest for this.

Bug 4346767

Change-Id: I1f54b9b560b171a6b2ccf5304e13f5e76fbbfacb
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3035747
(cherry picked from commit 2ce1e851bb)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3036782
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-18 05:24:17 -08:00
Joshua Cha
1b537bff19 nvsciipc: fix mixed license
Bug 4405013

Change-Id: I4c37c89b7dcc4c25e0b4e568b8d68d1a73c424f7
Signed-off-by: Joshua Cha <joshuac@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3028570
(cherry picked from commit 21a661c58f)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3030718
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-13 01:39:30 -08:00
Paritosh Dixit
75363cdd58 device-tree: generic: Fix issue in use of objtree
Fix issue in building the DTBs when KERNEL_OUTPUT and KERNEL_HEADERS
are specified as different directories in the OOT modules' Makefile.
In that case, srctree is set to KERNEL_HEADERS and objtree is set to
KERNEL_OUTPUT, and device-tree Makefile should be able to handle the
case when srctree and objtree are specified as different directories.

Bug 4295120

Change-Id: I164288e957f791d8e8072926743d0a80e23da9cb
Signed-off-by: Paritosh Dixit <paritoshd@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3033099
Reviewed-by: svc-sw-mobile-l4t <svc-sw-mobile-l4t@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-12 17:09:58 -08:00
Laxman Dewangan
09b54bda42 pci: Use conftest to find if probe of pci_epf_driver has ID arg
Use conftest to determine if the struct pci_epf_driver probe
API has ID argument or not

The additional argument as ID is added in probe() of the
struct pci_epf_driver with commit 081c715dfd5054 ("PCI:
endpoint: Pass EPF device ID to the probe function")
in Linux 6.4.

Bug 4346767

Change-Id: I004d1d3a8df922c0534c5631baa26f82f6992e4d
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3030052
(cherry picked from commit 0ed8b4e22a)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3032101
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
2023-12-12 03:39:59 -08:00
Laxman Dewangan
4a1a87890d pci: Use conftest to find if pci_enable_pcie_error_reporting() present
Use conftest to find if API pci_enable_pcie_error_reporting()
is present. This API is dropped from Linux 6.5 with change
commit 7ec4b34be42345 ("PCI/AER: Unexport
pci_enable_pcie_error_reporting()")

Bug 4346767

Change-Id: Ib0037544b4480b37c0ed6ac8b9ef9aef6ae82619
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3028742
(cherry picked from commit bf46060d1e)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3032090
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
2023-12-12 03:39:54 -08:00
Laxman Dewangan
ab8b8a6c84 pci: Use conftest to find if pci_disable_pcie_error_reporting() present
Use conftest to find if API pci_disable_pcie_error_reporting()
is present. This API is dropped from Linux 6.5 with change
commit 69b264df8a41282 ("PCI/AER: Drop unused
pci_disable_pcie_error_reporting()")

Bug 4346767

Change-Id: Idcaf36e4215a874c70f7457a46fd875f1349b121
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3028741
(cherry picked from commit f9f8b37e74)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3032100
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
2023-12-12 03:39:49 -08:00
Laxman Dewangan
9c77439e40 pci-epf: probe has additional APIs for Linux 6.6
The probe callback of driver "pci_epf_driver" has additonal
APIs as pci_epf_device_id for Linux 6.6 and above.

Add this new argument for Linux 6.6 and above.

Bug 4374520

Change-Id: Ie744a98947b895fce83f1a9df598ddbee2c3d138
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3014991
(cherry picked from commit 64b442b57d)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3032098
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
2023-12-12 03:39:45 -08:00
Laxman Dewangan
715c34434f nvscic2c-pcie: epc: Drop calling of error reporting for Linux 6.6
The API pci_disable_pcie_error_reporting() is dropped from
Linux 6.6. Remove the calling of this APIs for Linux 6.6
and later.

Bug 4374520

Change-Id: Iabb66dda70e6fe3a70be5ff14199b32b9c0ca3fa
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3014988
(cherry picked from commit a1cc281c17)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3032097
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Tested-by: Jonathan Hunter <jonathanh@nvidia.com>
2023-12-12 03:39:40 -08:00
Jon Hunter
c196de1377 spi: tegra124-slave: Fix callback prototype
The Tegra124 SPI slave driver declares a prototype for the function
tegra_spi_slave_register_callback() that does not exist. The correct
function name is tegra124_spi_slave_register_callback() and so fix the
prototype accordingly. Move the prototype to an actual header because
this is the correct place for defining prototypes for other drivers to
reference. This was caught by enabling the compiler flag
-Wmissing-prototype.

Bug 4404965

Change-Id: I765723d0a5ed6369784e5f6c480a6f03500659f3
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3027487
(cherry picked from commit 19a85c968c)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3031243
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-11 12:09:42 -08:00
Jon Hunter
0940779cd6 net: hv-net: Remove driver source
The Tegra HV Net driver has been deprecated and so remove the source for
the driver.

Bug 3832837

Change-Id: I7eae6e92bf0c95e96ed4eca08b857105325f2238
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2867180
(cherry picked from commit 739b5f1c7b)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3031238
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-11 07:39:29 -08:00
Jon Hunter
029ade906d arm64: Remove Tegra194 device-tree
Tegra194 is no longer supported and all testing has now been disabled,
so remove the Tegra194 device-tree.

Bug 4047365

Change-Id: Id6b65f6761652785e04cc850fd4b4ef6ed8cc20e
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3017348
(cherry picked from commit e7020ca405)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3029977
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-09 04:09:46 -08:00
Jon Hunter
b5d808a6ff drm/tegra: Avoid kernel version checks
Instead of using kernel version checks in the Tegra DRM driver for the
tegra_fb_ops structure, just check if the appropriate definition is
defined and if so use it. This fixes building the Tegra DRM driver
against some 3rd party kernels that include backports from upstream.

Note that this also aligns the driver closer to the upstream code by
using the same definitions that the upstream driver uses.

Bug 4346767

Change-Id: I8cb40899d0bf7cdc233e5f4cee7b6afb6f12d015
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3027832
(cherry picked from commit 086fc6d3da)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3030330
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-08 02:54:19 -08:00
Jon Hunter
6fe3abc899 drm/tegra: Drop version check
The version check in the Tegra DRM GEM code is not necessary because
this is a fix to the code and so remove the version check.

Bug 3820317

Change-Id: Ib7f5bd2bdb61af50e17399079aa2439bf8d352b1
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3026925
(cherry picked from commit 91c367006c)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3029984
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-12-07 09:10:06 -08:00
Jon Hunter
a6701b19b9 drivers: Use conftest for vm_flags
The conftest script has a test for checking if the vm_area struct has a
const vm_flags member. So enable this test and use the definition
generated in the appropriate drivers.

Bug 4374520

Change-Id: I0e7bd105fe8a821b0af23c0a5553b8d4468fa8c4
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3026924
(cherry picked from commit d0e427c6e1)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3029982
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-12-07 09:09:56 -08:00
Jon Hunter
daec781815 conftest: Add devm_tegra_core_dev_init_opp_table_common
Add a test to the conftest script to check if the function
devm_tegra_core_dev_init_opp_table_common() is present in the kernel and
use the definition generated in the host1x driver.

Bug 3820317

Change-Id: Id04da12c8ced7129141036aaa26375113c544374
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3026923
(cherry picked from commit 732a0db90e)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3029981
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-07 09:09:46 -08:00
Jon Hunter
60adf47e0f drm/tegra: Always use devm_pm_runtime_enable
The function devm_pm_runtime_enable() has been supported since Linux
v5.15 and so always use this function.

Bug 3820317

Change-Id: I805f3c681822b4bfc825b671c54a7dea2199f351
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3026922
(cherry picked from commit 591949a2f1)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3029980
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-07 09:09:41 -08:00
Jon Hunter
7997b6e8b0 net: nvethernet: Use conftest for Linux v6.6
In Linux v6.6, the header net/page_pool.h was split into two headers;
net/page_pool/helper.h and net/page_pool/types.h. Use the conftest
script to detect which of these headers are present and generate compile
time definitions for including the appropriate headers.

Bug 4346767

Change-Id: I389ce5b867a1efd867b8392bb21383784c1b4af6
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3026553
(cherry picked from commit cd4dce2c20)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3028310
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-12-05 09:24:31 -08:00
Shubhi Garg
b02f2cd5ee rtc: update VRS RTC IRQ to system hwclock
Update RTC IRQ occurred to system hwclock by adding
rtc_update_irq in irq handler.

Bug 3740696

Change-Id: I1ad9c05f759b5b11f8f212eb91a709f1b3625336
Signed-off-by: Shubhi Garg <shgarg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2764942
(cherry picked from commit 1926f478143bb1962da8748b6cbc9c094c37a7a4)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2999458
(cherry picked from commit 608ed39528a9735ad229067c8f9c6853d9a33a6e)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3026474
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
2023-12-04 04:24:18 -08:00
Shobek Attupurath
ee4493d7bf rtl8822ce: Remove pr_debug redefinition
Issue: pr_debug is redfined to printk causing unwanted
       log prints in dmesg

Fix: Remove pr_debug redefintion in rtl8822ce driver

Bug 3844473
Bug 4392253

Change-Id: I3aed85b8d61a764a74c59c2eef5f1f3dd60dd14a
Signed-off-by: Shobek Attupurath <sattupurath@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2813193
(cherry picked from commit 83a4b1f131209e357f80015fba386286f2888423)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2827187
Signed-off-by: Revanth Kumar Uppala <ruppala@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3024490
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-11-29 20:39:17 -08:00
Praveen AC
9c2150982a drivers:media: Fix imx390 & imx185 probe issue.
Due to "mingain - 1" & "minexp - 1" during probe time observing
out of range whenever gain or exp is set "0" as min in DT.
Instead doing "maxgain + 1" & "maxexp + 1" to fix the probe.

Bug 4142996
Bug 4189361
Bug 4386912

Change-Id: I103e87b293079dadcd16b91f8e329ec9f938208c
Signed-off-by: Praveen AC <pac@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3020345
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: Ankur Pawar <ankurp@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-11-29 06:54:21 -08:00
Johnny Liu
9e94468082 video: tegra: support clock set rate for nvcsi
Dynamic frequency scaling based on the current workload is implemented
in the tegra_camera_platform driver. Registering the clock set rate
callback to allow the tegra_camera_platform driver to set the device
clock rate.

Bug 4374126

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: Iae8fb7952a2ad3b07c1506bfd12b709a252ec2f2
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3020547
(cherry picked from commit aae5cf4cb7)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3023114
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-11-28 04:45:57 -08:00
Johnny Liu
4f1d3dbeb3 video: tegra: support clock set rate for isp5
Dynamic frequency scaling based on the current workload is implemented
in the tegra_camera_platform driver. Registering the clock set rate
callback to allow the tegra_camera_platform driver to set the device
clock rate.

Bug 4374126

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: Ic4e65428c25a2b95b975e88d3865d995549e8ca7
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3020545
(cherry picked from commit d25c39fa00)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3023113
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-11-28 04:45:52 -08:00
Johnny Liu
4da134034b video: tegra: support clock set rate for vi5
Dynamic frequency scaling based on the current workload is implemented
in the tegra_camera_platform driver. Registering the clock set rate
callback to allow the tegra_camera_platform driver to set the device
clock rate.

Bug 4374126

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: I6c594155a15f8f7b3e4377c0340c287155a77aee
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3020537
(cherry picked from commit 53ebc773be)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3023112
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-11-28 04:45:47 -08:00
Johnny Liu
2527826ca1 platform: tegra: camera: add operation callback
The Nvhost-related APIs have been deprecated and are no longer
supported since our migration from K510 to K515. Therefore, the camera
platform driver should refrain from using "nvhost_*" functions to set
the clock rate.

Integrate the common operation callback interface into the
tegra_camera_dev_info structure. This modification allows individual
drivers to achieve clock set rate operations by registering the
callback and completing the implementation.

Bug 4374126

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: Iebed7cc974f5dbdabddded3c84d0925de3a6c4f9
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3020535
(cherry picked from commit 57a82628aa)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3023111
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-11-28 04:45:42 -08:00
Jon Hunter
5fe2e2aacc gpu/host1x: Use conftest for Linux v6.3
Use conftest to determine if the uevent() function pointer in the
bus_type structure has a const dev argument. This fixes the build for
Linux kernels prior to Linux v6.3 that include the upstream change that
changed the arguments to this function.

Bug 4014315

Change-Id: I1553e08c951be9dd27141c273bf91be38dd954a6
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3019964
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-11-21 11:54:42 -08:00
Jon Hunter
067fbd7bbc net: nvethernet: Use conftest for Linux v6.3
Add tests to conftest for detecting if the mii_bus structure has the
read_c45 and write_c45 function pointers and use the definitions
generated by conftest in the nvethernet driver.

This fixes support for nvethernet in 3rd party Linux kernels that have
backported the mii_bus structure changes to their kernel that have a
kernel version prior to Linux v6.3.

Bug 4014315

Change-Id: I5ae98fc5077337286921da6e9347df9781565a70
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3018935
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
2023-11-21 05:10:51 -08:00
Yi-Wei Wang
856471d64f thermal: add thermal trip event cooling device
This change adds a cooling device driver to notify the user space of the
thermal trip event. To avoid having user space process poll the
cooling state, a sysfs node is exposed that supports blocking reads.
The driver also supports a timeout (in milliseconds) for blocking reads
which can be done by writing the value to thermal_trip_event_block node
before reading. The blocked user space process will be woken up when the
cooling device becomes active or times out.

Bug 4261645
Bug 1688327

Signed-off-by: Yi-Wei Wang <yiweiw@nvidia.com>
Change-Id: Ic89406ba2713e5bc8f3806d6cfeb462601c73a7d
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3015652
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: Rajkumar Kasirajan <rkasirajan@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-11-20 20:09:29 -08:00
Jon Hunter
a3b3ef5cab drm/tegra: Add conftest for fd/handle conversions
Add tests to the conftest script to check if the functions
drm_gem_prime_fd_to_handle() and drm_gem_prime_handle_to_fd() are
exported in the Linux kernel and use the definition generated by
conftest for compiling the Tegra DRM driver.

Bug 4346767

Change-Id: I56b76617bf4644a5851484dd7d4eecd3888f3b5b
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3015841
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
2023-11-20 13:24:26 -08:00
Mohan Kumar
7ffd0c9cfa ASoC: tegra: avoid enabling aud_mclk during init
Enabling the aud_mclk clock during initialization of drivers
was done for T30 chip due to some external dependencies, now
it is not required for latest version of chips and also due
to this aud_mclk is kept always ON. Add check to avoid enabling
aud_mclk clock other than T30

Bug 4373898

Change-Id: If341b1b73051c5572c5551bf6d4659fab7a116d2
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3015891
Reviewed-by: Sharad Gupta <sharadg@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-11-20 02:54:22 -08:00
Johnny Liu
7ff7dcd36a drm/tegra: Send ICC requests with peak_bw
When BPMP BWMGR receives ICC avg_bw requests from different memory
clients, it will sum up all avg_bw values together and use it to
determine the final EMC frequency.

Transitioning to ICC peak_bw requests will cause BPMP to evaluate
the bandwidth requirements of each memory client individually,
selecting the maximum bandwidth request from among all the clients
to determine the final EMC frequency.

This modification prevents excessive memory bandwidth allocation
when multiple host1x clients collaborate for data processing.
Currently, host1x clients request the full theoretical 100% data
bandwidth, even though the system typically doesn't fully utilize
that amount during runtime.

To address the issue of insufficient memory bandwidth when multiple
host1x clients are used together, we can reduce the boost_up_threshold
value of cactmon DFS. This adjustment ensures that when actual memory
bandwidth utilization surpasses the specified boost-up bandwidth
threshold, EMC frequency will be further scaled by one step further
to alleviate the problem.

Bug 4328471

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: I826a374666f38718652c5cae449c0aadeabfbdb5
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2996561
(cherry picked from commit 21c6a3b3e8)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3014611
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-11-13 14:56:26 -08:00
Gautham Srinivasan
c0bc0aa39c drivers: aon: Add AON Echo driver
Add AON echo driver. This driver creates data_channel file in sysfs
which is used to communicate between CCPLEX and AON.

Bug 4296173

Change-Id: Id790fc4076205e16509611f7fa07ffc073491227
Signed-off-by: Gautham Srinivasan <gauthams@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2954202
(cherry picked from commit 66c26d1ac3)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3012984
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
2023-11-08 09:24:44 -08:00
557 changed files with 208196 additions and 87978 deletions

View File

@@ -5,19 +5,24 @@ correlation feature.
Required properties:
- compatibles: should be "nvpps,tegra194-nvpps"
- compatible: This should be nvidia,tegra194-nvpps for Xavier and nvidia,tegra234-nvpps for Orin.
Optional properties:
- gpios: GPIO number and active level for the PPS input signal
- primary-emac: specifies ethernet emac device DT. This is the primary ethernet MAC device utilized
to calculate PTP time. For example, if MGBE0 is used to calculate the PTP time,
then phandle of the device tree node corresponding to MGBE0 needs to be passed.
For Example for Orin:
mgbe0: ethernet@6800000
eqos: ethernet@2310000
For Example for Xavier:
eqos: ethernet@2490000
- sec-emac: specifies secondary ethernet MAC device DT node to be used to calculate PTP time.
- memmap_phc_regs: boolean flag to indicate MAC PHC regs to be memory mapped
for getting PTP time. If not defined ptp notifer method will
be used with selected interface
- interface: NW interface name to be used for MAC PHC regs. This field can be
set to 'eqos_0', 'mgbe0_0', 'mgbe1_0', 'mgbe2_0' or 'mgbe3_0' for Orin.
For Xavier, it shoud be set to 'eqos_0'. If undef, default to 'eqos_0'
- sec_interface: NW interface name to be used to calculate PTP Time offset.
set to 'eqos_0', 'mgbe0_0', 'mgbe1_0', 'mgbe2_0' or 'mgbe3_0' for Orin.
For Xavier, Leave this undefined. For Orin, If undef default to 'eqos_0'
- ptp_tsc_k_int: Specifies the integer part of the factor used to calculate the delta to
apply to NUM when the fast convergence algorithm is enabled when syncing
or locking TSC time with PTP time domain.
@@ -31,42 +36,78 @@ Optional properties:
If unspecified, NvPPS driver uses 0x26C(corresponding to 20us) by default
- ptp_tsc_sync_dis: boolean flag to indicate if nvpps should disable PTP TSC sync logic.
The default behaviour is to keep PTP TSC sync logic enabled.
- reg: specifies start address and registers count details of TSC module. It is only applicable for Orin.
- nvpps-gpios: specifies GPIO number for PPS input signal.
- timestamps: specifies timestamp for the GPIO provided by HTE.
- timestamp-names: specifies name for GPIO timestamp.
Example:
Example: Timer mode on Orin.
nvpps {
compatible = "nvidia,tegrat194-nvpps";
status = "okay";
gpios = <&tegra_aon_gpio TEGRA194_AON_GPIO(BB, 2) GPIO_ACTIVE_HIGH>;
mgbe0: ethernet@6800000{
};
Example:
nvpps {
status = "okay";
compatible = "nvidia,tegra234-nvpps";
primary-emac = <&mgbe0>;
sec-emac = <&mgbe0>;
reg = <0x0 0xc6a0000 0x0 0x1000>;
};
Example: Timer mode on Xavier
eqos: ethernet@2490000{
};
nvpps {
compatible = "nvidia,tegra194-nvpps";
status = "okay";
gpios = <&tegra_aon_gpio TEGRA234_AON_GPIO(EE, 6) GPIO_ACTIVE_HIGH>;
compatible = "nvidia,tegra194-nvpps";
primary-emac = <&eqos>;
sec-emac = <&eqos>;
};
Example: MAC PHC regs to be memory mapped on Orin
mgbe0: ethernet@6800000{
};
nvpps {
status = "okay";
compatible = "nvidia,tegra234-nvpps";
primary-emac = <&mgbe0>
sec-emac = <&mgbe0>;
memmap_phc_regs;
interface = "mgbe2_0";
reg = <0x0 0xc6a0000 0x0 0x1000>;
};
Example:
Example: GPIO mode on Orin
mgbe0: ethernet@6800000{
};
nvpps {
compatible = "nvidia,tegra194-nvpps";
status = "okay";
gpios = <&tegra_aon_gpio TEGRA234_AON_GPIO(EE, 6) GPIO_ACTIVE_HIGH>;
interface = "mgbe2_0";
sec_interface = "eqos_0";
compatible = "nvidia,tegra234-nvpps";
reg = <0x0 0xc6a0000 0x0 0x1000>;
nvpps-gpios = <&gpio_aon TEGRA234_AON_GPIO(BB, 0) GPIO_ACTIVE_HIGH>;
timestamps = <&hte_aon TEGRA234_AON_GPIO(BB, 0)>;
timestamp-names = "nvpps_gpio";
};
Example: Timer mode on Orin with additional properties.
mgbe0: ethernet@6800000{
};
nvpps {
status = "okay";
compatible = "nvidia,tegra234-nvpps";
primary-emac = <&mgbe0>;
sec-emac = <&mgbe0>;
reg = <0x0 0xc6a0000 0x0 0x1000>;
ptp_tsc_k_int = /bits/ 8 <0x70>;
ptp_tsc_lock_threshold = /bits/ 16 <0x26C>;
ptp_tsc_sync_dis;
};
Example: GPIO as optional
nvpps {
compatible = "nvidia,tegra194-nvpps";
status = "okay";
interface = "mgbe2_0";
};

View File

@@ -1,67 +1,11 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2022-2023, NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2022-2024, NVIDIA CORPORATION. All rights reserved.
LINUXINCLUDE += -I$(srctree.nvconftest)
LINUXINCLUDE += -I$(srctree.nvidia-oot)/include
subdir-ccflags-y += -Werror
LINUX_VERSION := $(shell expr $(VERSION) \* 256 + $(PATCHLEVEL))
LINUX_VERSION_6_2 := $(shell expr 6 \* 256 + 2)
LINUX_VERSION_6_3 := $(shell expr 6 \* 256 + 3)
LINUX_VERSION_6_6 := $(shell expr 6 \* 256 + 6)
# The Tegra IVC driver was updated to support iosys-map in Linux v6.2.
# For Linux v6.2 kernels, don't build any drivers that requires this.
ifeq ($(shell test $(LINUX_VERSION) -ge $(LINUX_VERSION_6_2); echo $$?),0)
export CONFIG_TEGRA_IVC_LEGACY_DISABLE=y
endif
ifeq ($(CONFIG_TEGRA_IVC_LEGACY_DISABLE),y)
subdir-ccflags-y += -DCONFIG_TEGRA_IVC_LEGACY_DISABLE
endif
# Legacy GPIO support is removed in Linux v6.3
ifeq ($(shell test $(LINUX_VERSION) -ge $(LINUX_VERSION_6_3); echo $$?),0)
export CONFIG_TEGRA_GPIO_LEGACY_DISABLE=y
endif
# Changes done in Linux 6.6 onwards
ifeq ($(shell test $(LINUX_VERSION) -ge $(LINUX_VERSION_6_6); echo $$?),0)
# Move probe to DAI Ops.
export CONFIG_SND_SOC_MOVE_DAI_PROBE_TO_OPS=y
subdir-ccflags-y += -DNV_SND_SOC_DAI_OPS_STRUCT_HAS_PROBE_ARG
# probe_new is removed from i2c driver structure
subdir-ccflags-y += -DNV_I2C_LEGACY_PROBE_NEW_REMOVED
# API changes to replace u8 with unsigned char
subdir-ccflags-y += -DNV_TTY_SERIAL_TYPE_U8_CHANGE
# v4l2_async_subdev is renamed to v4l2_async_connection.
subdir-ccflags-y += -DNV_V4L2_ASYNC_SUBDEV_RENAME
# Rename V4L2_ASYNC_MATCH_FWNODE to V4L2_ASYNC_MATCH_TYPE_FWNODE
subdir-ccflags-y += -DNV_V4L2_ASYNC_MATCH_FWNODE_RENAME
# Rename async_nf_init and v4l2_async_subdev_nf_register
subdir-ccflags-y += -DNV_V4L2_ASYNC_NF_SUBDEVICE_INIT_RENAME
# Deprecate PCIED Error reporting pci_enable_pcie_error_reporting
subdir-ccflags-y += -DNV_DROP_PCIE_ERROR_REPORTING
# Split types and declaration of net/page_pool.h
subdir-ccflags-y += -DNV_SPLIT_PAGE_POOL_HEADER
# Unexport helpers for fd/handle conversion
subdir-ccflags-y += -DNV_UNEXPORT_FD_HANDLE_CONVERSION
# FB Deferred IO helpers name alignment
subdir-ccflags-y += -DNV_FB_DEFERRED_IO_OPS_RENAME
# Crypto driver has major change in it ops, skip it
export CONFIG_SKIP_CRYPTO=y
endif
subdir-ccflags-y += -Wmissing-prototypes
ifeq ($(CONFIG_TEGRA_VIRTUALIZATION),y)
subdir-ccflags-y += -DCONFIG_TEGRA_VIRTUALIZATION

View File

@@ -1,41 +0,0 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
objtree = $(srctree)
# Redefine the fixdep command
cmd_and_fixdep = \
$(cmd); \
$(objtree)/scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(dot-target).cmd;\
rm -f $(depfile)
include $(oottree)/scripts/Makefile.lib
oot-dtstree = $(oottree)/arch/arm64/boot/dts/nvidia
DTB_LIST := $(dtb-y)
DTBO_LIST := $(dtbo-y)
dtb-y :=
dts_makefile=$(foreach d,$(wildcard $1*), $(call dts_makefile,$(d)/,$(2)) $(if $(findstring Makefile,$(d)),$(d)))
dts_mfiles = $(call dts_makefile, $(oot-dtstree), Makefile)
ifneq ($(dts_mfiles),)
dts-include :=
include $(dts_mfiles)
dtb-y := $(addprefix nvidia/,$(dtb-y))
dtbo-y := $(addprefix nvidia/,$(dtbo-y))
endif
DTC_INCLUDE := $(oottree)/include
DTB_LIST += $(dtb-y)
DTBO_LIST += $(dtbo-y)
DTB_OBJS := $(addprefix $(obj)/,$(DTB_LIST))
DTBO_OBJS := $(addprefix $(obj)/,$(DTBO_LIST))
dtbs: $(DTB_OBJS) $(DTBO_OBJS) FORCE
dtbsclean:
find $(oot-dtstree) -name *.dtb | xargs rm -rf
find $(oot-dtstree) -name *.dtbo | xargs rm -rf
find $(oot-dtstree) -name *.tmp | xargs rm -rf

View File

@@ -1,9 +0,0 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
DTC_FLAGS += -@
# DT overlays
dtbo-y += tegra194-carveouts.dtbo
dtbo-y += tegra194-jetson.dtbo
dtbo-y += tegra194-p3509-0000+p3668-0001-overlay.dtbo

View File

@@ -1,29 +0,0 @@
// SPDX-License-Identifier: GPL-2.0
/dts-v1/;
/plugin/;
/ {
fragment@0 {
target-path = "/";
__overlay__ {
reserved-memory {
#address-cells = <2>;
#size-cells = <2>;
ranges;
vpr: vpr-carveout {
compatible = "nvidia,vpr-carveout";
status = "okay";
};
};
tegra-carveouts {
compatible = "nvidia,carveouts-t19x";
memory-region = <&vpr>;
status = "okay";
};
};
};
};

View File

@@ -1,157 +0,0 @@
/*
* Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES.
*
* SPDX-License-Identifier: GPL-2.0
*/
/dts-v1/;
/plugin/;
#include <dt-bindings/clock/tegra194-clock.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/memory/tegra194-mc.h>
#include <dt-bindings/power/tegra194-powergate.h>
#include <dt-bindings/reset/tegra194-reset.h>
/ {
overlay-name = "Tegra194 Jetson Overlay";
compatible = "nvidia,tegra194";
fragment@0 {
target-path = "/bus@0/host1x@13e00000";
__overlay__ {
#address-cells = <2>;
#size-cells = <2>;
interrupt-parent = <&gic>;
ranges = <0x0 0x14800000 0x0 0x14800000 0x0 0x02800000>,
<0x0 0x24f00000 0x0 0x24f00000 0x0 0x00100000>;
nvdla0@15880000 {
compatible = "nvidia,tegra194-nvdla";
reg = <0x0 0x15880000 0x0 0x00040000>;
interrupts = <GIC_SPI 236 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&bpmp TEGRA194_CLK_DLA0_CORE>,
<&bpmp TEGRA194_CLK_DLA0_FALCON>;
clock-names = "nvdla", "nvdla_flcn";
resets = <&bpmp TEGRA194_RESET_DLA0>;
reset-names = "nvdla";
power-domains = <&bpmp TEGRA194_POWER_DOMAIN_DLAA>;
interconnects = <&mc TEGRA194_MEMORY_CLIENT_DLA0RDA &emc>,
<&mc TEGRA194_MEMORY_CLIENT_DLA0FALRDB &emc>,
<&mc TEGRA194_MEMORY_CLIENT_DLA0WRA &emc>,
<&mc TEGRA194_MEMORY_CLIENT_DLA0FALWRB &emc>;
interconnect-names = "dma-mem", "read-1", "write", "write-1";
iommus = <&smmu TEGRA194_SID_NVDLA0>;
dma-coherent;
};
nvdla1@158c0000 {
compatible = "nvidia,tegra194-nvdla";
reg = <0x0 0x158c0000 0x0 0x00040000>;
interrupts = <GIC_SPI 237 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&bpmp TEGRA194_CLK_DLA1_CORE>,
<&bpmp TEGRA194_CLK_DLA1_FALCON>;
clock-names = "nvdla", "nvdla_flcn";
resets = <&bpmp TEGRA194_RESET_DLA1>;
reset-names = "nvdla";
power-domains = <&bpmp TEGRA194_POWER_DOMAIN_DLAB>;
interconnects = <&mc TEGRA194_MEMORY_CLIENT_DLA1RDA &emc>,
<&mc TEGRA194_MEMORY_CLIENT_DLA1FALRDB &emc>,
<&mc TEGRA194_MEMORY_CLIENT_DLA1WRA &emc>,
<&mc TEGRA194_MEMORY_CLIENT_DLA1FALWRB &emc>;
interconnect-names = "dma-mem", "read-1", "write", "write-1";
iommus = <&smmu TEGRA194_SID_NVDLA1>;
dma-coherent;
};
pva0@16000000 {
compatible = "nvidia,tegra194-pva";
power-domains = <&bpmp TEGRA194_POWER_DOMAIN_PVAA>;
reg = <0x0 0x16000000 0x0 0x00800000>,
<0x0 0x24f00000 0x0 0x00080000>;
interrupts = <GIC_SPI 234 IRQ_TYPE_LEVEL_HIGH>;
resets = <&bpmp TEGRA194_RESET_PVA0_ALL>;
reset-names = "nvpva";
clocks = <&bpmp TEGRA194_CLK_NAFLL_PVA_VPS>,
<&bpmp TEGRA194_CLK_NAFLL_PVA_CORE>,
<&bpmp TEGRA194_CLK_PVA0_AXI>,
<&bpmp TEGRA194_CLK_PVA0_VPS0>,
<&bpmp TEGRA194_CLK_PVA0_VPS1>;
clock-names = "nafll_pva_vps", "nafll_pva_core", "axi", "vps0", "vps1";
interconnects = <&mc TEGRA194_MEMORY_CLIENT_PVA0RDA &emc>,
<&mc TEGRA194_MEMORY_CLIENT_PVA0RDB &emc>,
<&mc TEGRA194_MEMORY_CLIENT_PVA0RDC &emc>,
<&mc TEGRA194_MEMORY_CLIENT_PVA0WRA &emc>,
<&mc TEGRA194_MEMORY_CLIENT_PVA0WRB &emc>,
<&mc TEGRA194_MEMORY_CLIENT_PVA0WRC &emc>;
interconnect-names = "dma-mem", "read-b", "read-c", "write-a", "write-b", "write-c";
iommus = <&smmu TEGRA194_SID_PVA0>;
dma-coherent;
};
pva1@16800000 {
compatible = "nvidia,tegra194-pva";
power-domains = <&bpmp TEGRA194_POWER_DOMAIN_PVAB>;
reg = <0x0 0x16800000 0x0 0x00800000>,
<0x0 0x24f80000 0x0 0x00080000>;
interrupts = <GIC_SPI 235 IRQ_TYPE_LEVEL_HIGH>;
resets = <&bpmp TEGRA194_RESET_PVA1_ALL>;
reset-names = "nvpva";
clocks = <&bpmp TEGRA194_CLK_PVA1_AXI>,
<&bpmp TEGRA194_CLK_PVA1_VPS0>,
<&bpmp TEGRA194_CLK_PVA1_VPS1>;
clock-names = "axi", "vps0", "vps1";
interconnects = <&mc TEGRA194_MEMORY_CLIENT_PVA1RDA &emc>,
<&mc TEGRA194_MEMORY_CLIENT_PVA1RDB &emc>,
<&mc TEGRA194_MEMORY_CLIENT_PVA1RDC &emc>,
<&mc TEGRA194_MEMORY_CLIENT_PVA1WRA &emc>,
<&mc TEGRA194_MEMORY_CLIENT_PVA1WRB &emc>,
<&mc TEGRA194_MEMORY_CLIENT_PVA1WRC &emc>;
interconnect-names = "dma-mem", "read-b", "read-c", "write-a", "write-b", "write-c";
iommus = <&smmu TEGRA194_SID_PVA1>;
dma-coherent;
};
};
};
fragment@1 {
target-path = "/";
__overlay__ {
#address-cells = <2>;
#size-cells = <2>;
cvnas@14000000 {
compatible = "nvidia,tegra194-cvnas";
reg = <0x0 0x14000000 0x0 0x20000>, /* CV0_REG0_BASE */
<0x0 0x14020000 0x0 0x10000>, /* CV0_SRAM_BASE */
<0x0 0x0b240000 0x0 0x10000>; /* HSM_BASE */
interrupt-parent = <&gic>;
interrupts = <GIC_SPI 238 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 239 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&bpmp TEGRA194_CLK_CVNAS>;
assigned-clocks = <&bpmp TEGRA194_CLK_CVNAS>;
assigned-clock-rates = <1356800000>;
resets = <&bpmp TEGRA194_RESET_CVNAS>,
<&bpmp TEGRA194_RESET_CVNAS_FCM>;
reset-names = "rst", "rst_fcm";
power-domains = <&bpmp TEGRA194_POWER_DOMAIN_CV>;
cvsramslice = <4 0x1000>;
cvsram-reg = <0x0 0x50000000 0x0 0x400000>;
};
};
};
};

View File

@@ -1,9 +0,0 @@
// SPDX-License-Identifier: GPL-2.0
/dts-v1/;
/plugin/;
/ {
overlay-name = "Add p3509-0000+p3668-0001 Overlay Support";
compatible = "nvidia,tegra194";
};

View File

@@ -1,7 +1,7 @@
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: GPL-2.0-only
objtree = $(srctree)
objtree ?= $(srctree)
# Redefine the fixdep command
cmd_and_fixdep = \

View File

@@ -5,102 +5,102 @@ MAKE[0]="make modules"
BUILT_MODULE_NAME[0]="softdog-platform"
BUILT_MODULE_LOCATION[0]="drivers/watchdog"
DEST_MODULE_LOCATION[0]="/extra"
DEST_MODULE_LOCATION[0]="/updates"
BUILT_MODULE_NAME[1]="watchdog-tegra-t18x"
BUILT_MODULE_LOCATION[1]="drivers/watchdog"
DEST_MODULE_LOCATION[1]="/extra"
DEST_MODULE_LOCATION[1]="/updates"
BUILT_MODULE_NAME[2]="pex9749-thermal"
BUILT_MODULE_LOCATION[2]="drivers/thermal"
DEST_MODULE_LOCATION[2]="/extra"
DEST_MODULE_LOCATION[2]="/updates"
BUILT_MODULE_NAME[3]="spi-aurix-tegra"
BUILT_MODULE_LOCATION[3]="drivers/spi"
DEST_MODULE_LOCATION[3]="/extra"
DEST_MODULE_LOCATION[3]="/updates"
BUILT_MODULE_NAME[4]="tegra186-gpc-dma"
BUILT_MODULE_LOCATION[4]="drivers/dma"
DEST_MODULE_LOCATION[4]="/extra"
DEST_MODULE_LOCATION[4]="/updates"
BUILT_MODULE_NAME[5]="pwm-tegra-tachometer"
BUILT_MODULE_LOCATION[5]="drivers/pwm"
DEST_MODULE_LOCATION[5]="/extra"
DEST_MODULE_LOCATION[5]="/updates"
BUILT_MODULE_NAME[6]="pinctrl-tegra234"
BUILT_MODULE_LOCATION[6]="drivers/pinctrl/tegra"
DEST_MODULE_LOCATION[6]="/extra"
DEST_MODULE_LOCATION[6]="/updates"
BUILT_MODULE_NAME[7]="tegra-cactmon"
BUILT_MODULE_LOCATION[7]="drivers/platform/tegra"
DEST_MODULE_LOCATION[7]="/extra"
DEST_MODULE_LOCATION[7]="/updates"
BUILT_MODULE_NAME[8]="pinctrl-tegra234-dpaux"
BUILT_MODULE_LOCATION[8]="drivers/pinctrl"
DEST_MODULE_LOCATION[8]="/extra"
DEST_MODULE_LOCATION[8]="/updates"
BUILT_MODULE_NAME[9]="tegra-fsicom"
BUILT_MODULE_LOCATION[9]="drivers/platform/tegra"
DEST_MODULE_LOCATION[9]="/extra"
DEST_MODULE_LOCATION[9]="/updates"
BUILT_MODULE_NAME[10]="tegra-bootloader-debug"
BUILT_MODULE_LOCATION[10]="drivers/platform/tegra"
DEST_MODULE_LOCATION[10]="/extra"
DEST_MODULE_LOCATION[10]="/updates"
BUILT_MODULE_NAME[11]="host1x-fence"
BUILT_MODULE_LOCATION[11]="drivers/gpu/host1x-fence"
DEST_MODULE_LOCATION[11]="/extra"
DEST_MODULE_LOCATION[11]="/updates"
BUILT_MODULE_NAME[12]="tegra_vnet"
BUILT_MODULE_LOCATION[12]="drivers/net/ethernet/nvidia/pcie"
DEST_MODULE_LOCATION[12]="/extra"
DEST_MODULE_LOCATION[12]="/updates"
BUILT_MODULE_NAME[13]="arm64-ras"
BUILT_MODULE_LOCATION[13]="drivers/ras"
DEST_MODULE_LOCATION[13]="/extra"
DEST_MODULE_LOCATION[13]="/updates"
BUILT_MODULE_NAME[14]="fuse-burn"
BUILT_MODULE_LOCATION[14]="drivers/soc/tegra/fuse"
DEST_MODULE_LOCATION[14]="/extra"
DEST_MODULE_LOCATION[14]="/updates"
BUILT_MODULE_NAME[15]="kfuse"
BUILT_MODULE_LOCATION[15]="drivers/soc/tegra/fuse"
DEST_MODULE_LOCATION[15]="/extra"
DEST_MODULE_LOCATION[15]="/updates"
BUILT_MODULE_NAME[16]="pci-epf-dma-test"
BUILT_MODULE_LOCATION[16]="drivers/pci/endpoint/functions"
DEST_MODULE_LOCATION[16]="/extra"
DEST_MODULE_LOCATION[16]="/updates"
BUILT_MODULE_NAME[17]="tegra-pcie-edma"
BUILT_MODULE_LOCATION[17]="drivers/pci/controller"
DEST_MODULE_LOCATION[17]="/extra"
DEST_MODULE_LOCATION[17]="/updates"
BUILT_MODULE_NAME[18]="pcie-tegra-vf"
BUILT_MODULE_LOCATION[18]="drivers/pci/controller"
DEST_MODULE_LOCATION[18]="/extra"
DEST_MODULE_LOCATION[18]="/updates"
BUILT_MODULE_NAME[19]="tegra-pcie-dma-test"
BUILT_MODULE_LOCATION[19]="drivers/misc"
DEST_MODULE_LOCATION[19]="/extra"
DEST_MODULE_LOCATION[19]="/updates"
BUILT_MODULE_NAME[20]="tegra-se"
BUILT_MODULE_LOCATION[20]="drivers/crypto/tegra"
DEST_MODULE_LOCATION[20]="/extra"
DEST_MODULE_LOCATION[20]="/updates"
BUILT_MODULE_NAME[21]="tegra-se-nvrng"
BUILT_MODULE_LOCATION[21]="drivers/crypto"
DEST_MODULE_LOCATION[21]="/extra"
DEST_MODULE_LOCATION[21]="/updates"
BUILT_MODULE_NAME[22]="nvidia-vrs-pseq"
BUILT_MODULE_LOCATION[22]="drivers/mfd"
DEST_MODULE_LOCATION[22]="/extra"
DEST_MODULE_LOCATION[22]="/updates"
BUILT_MODULE_NAME[23]="cpuidle-debugfs"
BUILT_MODULE_LOCATION[23]="drivers/cpuidle"
DEST_MODULE_LOCATION[23]="/extra"
DEST_MODULE_LOCATION[23]="/updates"
BUILT_MODULE_NAME[24]="pinctrl-tegra194-pexclk-padctrl"
BUILT_MODULE_LOCATION[24]="drivers/pinctrl"
DEST_MODULE_LOCATION[24]="/extra"
DEST_MODULE_LOCATION[24]="/updates"
AUTO_INSTALL="yes"

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-only
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
LINUXINCLUDE += -I$(srctree.nvidia-oot)/include
LINUXINCLUDE += -I$(srctree.nvidia-oot)/drivers/gpu/host1x/hw/
@@ -17,9 +17,7 @@ endif
obj-m += c2c/
obj-m += clink/
obj-m += cpuidle/
ifeq ($(CONFIG_SKIP_CRYPTO),)
obj-m += crypto/
endif
ifdef CONFIG_PM_DEVFREQ
obj-m += devfreq/
endif
@@ -34,10 +32,12 @@ endif
ifdef CONFIG_I2C
obj-m += i2c/busses/
obj-m += mfd/
ifdef CONFIG_HTE
ifdef CONFIG_IIO
obj-m += bmi088/
endif
endif
endif
ifdef CONFIG_MEMORY
obj-m += memory/
endif
@@ -81,7 +81,5 @@ obj-m += virt/tegra/
ifdef CONFIG_TEGRA_HOST1X
obj-m += media/
endif
obj-m += staging/platform/tegra/gte/
obj-m += staging/platform/tegra/gte_test/
obj-m += nv-virtio/
obj-m += usb/

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
// Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-FileCopyrightText: Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
/* Device tree example:
*
@@ -7,13 +7,15 @@
* compatible = "bmi,bmi088";
* reg = <0x69>; // <-- Must be gyroscope I2C address
* accel_i2c_addr = <0x19>; // Must be specified
* accel_irq_gpio = <&tegra_gpio TEGRA_GPIO(BB, 0) GPIO_ACTIVE_HIGH>;
* gyro_irq_gpio = <&tegra_gpio TEGRA_GPIO(BB, 1) GPIO_ACTIVE_HIGH>;
* accel_irq-gpios = <&tegra_gpio TEGRA_GPIO(BB, 0) GPIO_ACTIVE_HIGH>;
* gyro_irq-gpios = <&tegra_gpio TEGRA_GPIO(BB, 1) GPIO_ACTIVE_HIGH>;
* accel_matrix = [01 00 00 00 01 00 00 00 01];
* gyro_matrix = [01 00 00 00 01 00 00 00 01];
* };
*/
#include <nvidia/conftest.h>
#include <linux/device.h>
#include <linux/version.h>
#include <linux/i2c.h>
@@ -25,8 +27,8 @@
#include <linux/gpio.h>
#include <linux/of_gpio.h>
#include <linux/of.h>
#include <linux/tegra-gte.h>
#include <linux/bitops.h>
#include <linux/hte.h>
#include "bmi_iio.h"
#define BMI_NAME "bmi088"
@@ -107,22 +109,17 @@
#define BMI_PART_BMI088 (0)
#define HTE_TIMEOUT (msecs_to_jiffies(100))
static const struct i2c_device_id bmi_i2c_device_ids[] = {
{ BMI_NAME, BMI_PART_BMI088 },
{},
};
static char *gte_hw_str_t194 = "nvidia,tegra194-gte-aon";
static char *gte_hw_str_t234 = "nvidia,tegra234-gte-aon";
static struct device_node *gte_nd;
struct bmi_gte_irq {
struct tegra_gte_ev_desc *gte;
struct bmi_gpio_irq {
struct gpio_desc *gpio_in;
const char *dev_name;
int gpio;
int irq;
u64 irq_ts;
u64 irq_ts_old;
};
struct bmi_reg_rd {
@@ -411,18 +408,21 @@ struct bmi_snsr {
struct sensor_cfg cfg;
unsigned int usr_cfg;
unsigned int period_us;
u64 irq_ts;
u64 irq_ts_old;
u64 seq;
struct completion hte_ts_cmpl;
struct bmi_gpio_irq gis;
struct bmi_state *st;
};
struct bmi_state {
struct i2c_client *i2c;
struct bmi_snsr snsrs[BMI_HW_N];
struct bmi_gte_irq gis[BMI_HW_N];
bool iio_init_done[BMI_HW_N];
unsigned int part;
unsigned int sts;
unsigned int errs_bus[BMI_HW_N];
unsigned int err_ts_thread[BMI_HW_N];
unsigned int sam_dropped[BMI_HW_N];
unsigned int enabled;
unsigned int suspend_en_st;
unsigned int hw_n;
@@ -537,141 +537,36 @@ static int bmi_i2c_wr(struct bmi_state *st, unsigned int hw, u8 reg, u8 val)
return ret;
}
static void bmi_gte_exit_gpio(struct bmi_gte_irq *ngi, unsigned int n)
{
unsigned int i;
for (i = 0; i < n; i++) {
if (ngi[i].gpio >= 0)
gpio_free(ngi[i].gpio);
}
}
static int bmi_gte_init_gpio2irq(struct device *dev, struct bmi_gte_irq *ngi,
unsigned int n)
{
unsigned int i;
unsigned int prev;
int ret;
for (i = 0; i < n; i++) {
if (!gpio_is_valid(ngi[i].gpio) ||
gpio_request(ngi[i].gpio, ngi[i].dev_name)) {
ret = -EPROBE_DEFER;
if (!i) {
goto out_no_prev;
} else {
prev = i - 1;
goto out;
}
}
ret = gpio_direction_input(ngi[i].gpio);
if (ret < 0) {
dev_err(dev, "%s gpio_dir_input(%d) ERR:%d\n",
ngi[i].dev_name, ngi[i].gpio, ret);
ret = -ENODEV;
if (!i)
prev = i;
else
prev = i - 1;
goto out;
}
ret = gpio_to_irq(ngi[i].gpio);
if (ret <= 0) {
dev_err(dev, "%s gpio_to_irq(%d) ERR:%d\n",
ngi[i].dev_name, ngi[i].gpio, ret);
ret = -ENODEV;
if (!i)
prev = i;
else
prev = i - 1;
goto out;
}
ngi[i].irq = ret;
ret = 0;
}
return ret;
out:
bmi_gte_exit_gpio(ngi, prev);
out_no_prev:
return ret;
}
static int bmi_gte_ts(struct bmi_gte_irq *ngi)
{
struct tegra_gte_ev_desc *desc = (struct tegra_gte_ev_desc *)ngi->gte;
struct tegra_gte_ev_detail dtl;
int ret;
ret = tegra_gte_retrieve_event(desc, &dtl);
if (!ret)
ngi->irq_ts = dtl.ts_ns;
return ret;
}
static inline int bmi_gte_deinit(struct bmi_gte_irq *ngi)
{
int ret = 0;
if (ngi->gte) {
ret = tegra_gte_unregister_event(ngi->gte);
ngi->gte = NULL;
}
return ret;
}
static void bmi_gte_gpio_exit(struct bmi_state *st, unsigned int n)
{
unsigned int i;
struct bmi_gte_irq *ngi = st->gis;
if (gte_nd) {
of_node_put(gte_nd);
gte_nd = NULL;
}
for (i = 0; i < n; i++) {
bmi_gte_deinit(&ngi[i]);
if (ngi[i].gpio >= 0)
gpio_free(ngi[i].gpio);
}
}
static int bmi_gte_init(struct bmi_state *st, unsigned int id)
{
int ret = 0;
struct bmi_gte_irq *ngi = st->gis;
if (!ngi[id].gte) {
ngi[id].gte = tegra_gte_register_event(gte_nd, ngi[id].gpio);
if (!ngi[id].gte)
ret = -ENODEV;
}
return ret;
}
static int bmi_setup_gpio(struct device *dev, struct bmi_state *st,
unsigned int n)
{
unsigned int i;
struct bmi_gte_irq *ngi = st->gis;
struct bmi_snsr *snsrs = st->snsrs;
int ret;
for (i = 0; i < n; i++)
ngi[i].irq = -1;
for (i = 0; i < n; i++) {
snsrs[i].gis.irq = -1;
if ((snsrs[i].gis.gpio_in)) {
ret = gpiod_direction_input(snsrs[i].gis.gpio_in);
return bmi_gte_init_gpio2irq(dev, ngi, n);
if (ret < 0) {
dev_err(dev, "%s gpio_dir_input ERR:%d\n",
snsrs[i].gis.dev_name, ret);
return ret;
}
ret = gpiod_to_irq(snsrs[i].gis.gpio_in);
if (ret < 0) {
dev_err(dev, "%s gpio_to_irq ERR:%d\n",
snsrs[i].gis.dev_name, ret);
return ret;
}
snsrs[i].gis.irq = ret;
}
}
return 0;
}
static int bmi_pm(struct bmi_state *st, int snsr_id, bool en)
@@ -967,17 +862,32 @@ static unsigned long bmi_gyr_irqflags(struct bmi_state *st)
return irqflags;
}
static enum hte_return process_hw_ts(struct hte_ts_data *ts, void *p)
{
struct bmi_snsr *sensor = (struct bmi_snsr *)p;
struct bmi_state *st = sensor->st;
sensor->irq_ts = ts->tsc;
sensor->seq = ts->seq;
complete(&sensor->hte_ts_cmpl);
dev_dbg_ratelimited(&st->i2c->dev, "%s: seq %llu, ts:%llu\n",
__func__, sensor->seq, sensor->irq_ts);
return HTE_CB_HANDLED;
}
static irqreturn_t bmi_irq_thread(int irq, void *dev_id)
{
struct bmi_state *st = (struct bmi_state *)dev_id;
struct bmi_snsr *sensor = (struct bmi_snsr *)dev_id;
struct bmi_state *st = sensor->st;
unsigned int hw;
int ret;
u8 reg;
u8 sample[BMI_IMU_DATA];
int cnt = 0;
u64 ts_old;
if (irq == st->gis[BMI_HW_GYR].irq) {
if (irq == st->snsrs[BMI_HW_GYR].gis.irq) {
hw = BMI_HW_GYR;
reg = BMI_REG_GYR_DATA;
} else {
@@ -985,7 +895,7 @@ static irqreturn_t bmi_irq_thread(int irq, void *dev_id)
reg = BMI_REG_ACC_DATA;
}
/* Disbale data ready interrupt before we read out data */
/* Disable data ready interrupt before we read out data */
ret = bmi_hws[hw].fn_able(st, 0, true);
if (unlikely(ret)) {
dev_err_ratelimited(&st->i2c->dev,
@@ -993,71 +903,31 @@ static irqreturn_t bmi_irq_thread(int irq, void *dev_id)
goto err;
}
ts_old = st->gis[hw].irq_ts_old;
/*
* There is a possibility that data ready IRQ may have caused GTE to
* store the timestamps by the time this thread got a chance to run
* and disable IRQ especially for the high data rate, in that case,
* drain the GTE till it returns error and use last timestamp to
* associate the data to be read.
*/
while (bmi_gte_ts(&st->gis[hw]) == 0)
cnt++;
/* Means we failed to get the ts in the first go */
if (!st->gis[hw].irq_ts && !cnt) {
dev_dbg(&st->i2c->dev, "sample dropped, gte get ts failed\n");
st->sam_dropped[hw]++;
goto out;
}
/*
* If ts is same as old or 0, something is seriously wrong,
* re-register with gte
*/
if ((st->gis[hw].irq_ts_old == st->gis[hw].irq_ts) ||
(!st->gis[hw].irq_ts && cnt)) {
dev_dbg(&st->i2c->dev,
"ts issue for: %d, ts old: %llu, new: %llu\n",
hw, st->gis[hw].irq_ts_old, st->gis[hw].irq_ts);
st->err_ts_thread[hw]++;
st->sam_dropped[hw]++;
dev_dbg(&st->i2c->dev, "sample dropped due to ts issues\n");
/* Re-register with GTE */
bmi_gte_deinit(&st->gis[hw]);
ret = bmi_gte_init(st, hw);
if (ret) {
dev_err_ratelimited(&st->i2c->dev,
"GTE re-registration failed: %d\n",
hw);
goto err;
}
goto out;
/* Wait for HTE IRQ to fetch the latest timestamp */
ret = wait_for_completion_interruptible_timeout(&sensor->hte_ts_cmpl, HTE_TIMEOUT);
if (!ret) {
dev_dbg_ratelimited(&st->i2c->dev,
"sample dropped due to timeout");
goto err;
}
mutex_lock(BMI_MUTEX(st->snsrs[hw].bmi_iio));
ret = bmi_i2c_rd(st, hw, reg, sizeof(sample), sample);
mutex_unlock(BMI_MUTEX(st->snsrs[hw].bmi_iio));
if (!ret) {
bmi_iio_push_buf(st->snsrs[hw].bmi_iio, sample,
st->gis[hw].irq_ts);
st->gis[hw].irq_ts_old = st->gis[hw].irq_ts;
sensor->irq_ts);
dev_dbg(&st->i2c->dev, "%d, ts= %lld ts_old= %lld\n",
hw, sensor->irq_ts, sensor->irq_ts_old);
sensor->irq_ts_old = sensor->irq_ts;
}
dev_dbg(&st->i2c->dev, "%d, ts= %lld, ts_old=%lld\n",
hw, st->gis[hw].irq_ts, ts_old);
mutex_unlock(BMI_MUTEX(st->snsrs[hw].bmi_iio));
out:
st->gis[hw].irq_ts = 0;
/* Enable data ready interrupt */
bmi_hws[hw].fn_able(st, 1, true);
err:
return IRQ_HANDLED;
}
@@ -1072,7 +942,7 @@ static int bmi_period(struct bmi_state *st, int snsr_id, bool range)
range);
}
static int bmi_enable(void *client, int snsr_id, int enable, bool is_gte)
static int bmi_enable(void *client, int snsr_id, int enable)
{
struct bmi_state *st = (struct bmi_state *)client;
int ret;
@@ -1084,20 +954,10 @@ static int bmi_enable(void *client, int snsr_id, int enable, bool is_gte)
return (st->enabled & (1 << snsr_id));
if (enable) {
if (is_gte) {
ret = bmi_gte_init(st, snsr_id);
if (ret)
return ret;
}
enable = st->enabled | (1 << snsr_id);
ret = bmi_pm(st, snsr_id, true);
if (ret < 0) {
if (is_gte)
bmi_gte_deinit(&st->gis[snsr_id]);
if (ret < 0)
return ret;
}
ret = bmi_period(st, snsr_id, true);
ret |= bmi_hws[snsr_id].fn_able(st, 1, false);
@@ -1107,9 +967,6 @@ static int bmi_enable(void *client, int snsr_id, int enable, bool is_gte)
}
}
if (is_gte)
bmi_gte_deinit(&st->gis[snsr_id]);
ret = bmi_hws[snsr_id].fn_able(st, 0, false);
ret |= bmi_pm(st, snsr_id, false);
@@ -1302,11 +1159,6 @@ static int bmi_read_err(void *client, int snsr_id, char *buf)
t += snprintf(buf, PAGE_SIZE, "%s:\n", st->snsrs[snsr_id].cfg.name);
t += snprintf(buf + t, PAGE_SIZE - t,
"I2C Bus Errors:%u\n", st->errs_bus[snsr_id]);
t += snprintf(buf + t, PAGE_SIZE - t,
"GTE Timestamp Errors:%u\n", st->err_ts_thread[snsr_id]);
t += snprintf(buf + t, PAGE_SIZE - t,
"Sample dropped:%u\n", st->sam_dropped[snsr_id]);
return t;
}
@@ -1389,11 +1241,9 @@ static int __maybe_unused bmi_suspend(struct device *dev)
for (i = 0; i < st->hw_n; i++) {
mutex_lock(BMI_MUTEX(st->snsrs[i].bmi_iio));
/* check if sensor is enabled to begin with */
old_en_st = bmi_enable(st, st->snsrs[i].cfg.snsr_id, -1,
false);
old_en_st = bmi_enable(st, st->snsrs[i].cfg.snsr_id, -1);
if (old_en_st) {
temp_ret = bmi_enable(st, st->snsrs[i].cfg.snsr_id, 0,
false);
temp_ret = bmi_enable(st, st->snsrs[i].cfg.snsr_id, 0);
if (!temp_ret)
st->suspend_en_st |= old_en_st;
@@ -1415,8 +1265,7 @@ static int __maybe_unused bmi_resume(struct device *dev)
for (i = 0; i < st->hw_n; i++) {
mutex_lock(BMI_MUTEX(st->snsrs[i].bmi_iio));
if (st->suspend_en_st & (1 << st->snsrs[i].cfg.snsr_id))
ret |= bmi_enable(st, st->snsrs[i].cfg.snsr_id, 1,
false);
ret |= bmi_enable(st, st->snsrs[i].cfg.snsr_id, 1);
mutex_unlock(BMI_MUTEX(st->snsrs[i].bmi_iio));
}
@@ -1437,8 +1286,8 @@ static void bmi_shutdown(struct i2c_client *client)
if (st->iio_init_done[i])
mutex_lock(BMI_MUTEX(st->snsrs[i].bmi_iio));
if (bmi_enable(st, st->snsrs[i].cfg.snsr_id, -1, false))
bmi_enable(st, st->snsrs[i].cfg.snsr_id, 0, false);
if (bmi_enable(st, st->snsrs[i].cfg.snsr_id, -1))
bmi_enable(st, st->snsrs[i].cfg.snsr_id, 0);
if (st->iio_init_done[i]) {
mutex_unlock(BMI_MUTEX(st->snsrs[i].bmi_iio));
@@ -1454,7 +1303,6 @@ static void bmi_remove(void *data)
if (st != NULL) {
bmi_shutdown(client);
bmi_gte_gpio_exit(st, BMI_HW_N);
for (i = 0; i < st->hw_n; i++) {
if (st->iio_init_done[i])
bmi_iio_remove(st->snsrs[i].bmi_iio);
@@ -1480,8 +1328,18 @@ static int bmi_of_dt(struct bmi_state *st, struct device_node *dn)
return -ENODEV;
}
st->gis[BMI_HW_ACC].gpio = of_get_named_gpio(dn, "accel_irq_gpio", 0);
st->gis[BMI_HW_GYR].gpio = of_get_named_gpio(dn, "gyro_irq_gpio", 0);
st->snsrs[BMI_HW_ACC].gis.gpio_in = devm_gpiod_get(&st->i2c->dev, "accel_irq", 0);
if (IS_ERR(st->snsrs[BMI_HW_ACC].gis.gpio_in)) {
dev_err(&st->i2c->dev, "accel_irq is not set in DT\n");
return PTR_ERR(st->snsrs[BMI_HW_ACC].gis.gpio_in);
}
st->snsrs[BMI_HW_GYR].gis.gpio_in = devm_gpiod_get(&st->i2c->dev, "gyro_irq", 0);
if (IS_ERR(st->snsrs[BMI_HW_GYR].gis.gpio_in)) {
dev_err(&st->i2c->dev, "gyro_irq is not set in DT\n");
return PTR_ERR(st->snsrs[BMI_HW_GYR].gis.gpio_in);
}
if (!of_property_read_u32(dn, "accel_reg_0x53", &val32))
st->ra_0x53 = (u8)val32;
@@ -1521,14 +1379,11 @@ static int bmi_init(struct bmi_state *st, const struct i2c_device_id *id)
unsigned long irqflags;
unsigned int i;
int ret;
struct hte_ts_desc *desc;
if (id == NULL)
return -EINVAL;
/* driver specific defaults */
for (i = 0; i < BMI_HW_N; i++)
st->gis[i].gpio = -1;
st->ra_0x53 = BMI_INT1_OUT_ACTIVE_HIGH;
st->ra_0x54 = 0x00;
st->ra_0x58 = BMI_INT1_DTRDY;
@@ -1545,13 +1400,6 @@ static int bmi_init(struct bmi_state *st, const struct i2c_device_id *id)
return ret;
}
/*
* Only interrupt mode is supported as we want hardware timestamps
* from GTE.
*/
if (st->gis[BMI_HW_ACC].gpio < 0 || st->gis[BMI_HW_GYR].gpio < 0)
return -EINVAL;
st->part = id->driver_data;
st->i2c_addrs[BMI_HW_GYR] = st->i2c->addr;
ret = bmi_reset_all(st);
@@ -1580,31 +1428,63 @@ static int bmi_init(struct bmi_state *st, const struct i2c_device_id *id)
st->snsrs[i].cfg.part = bmi_i2c_device_ids[st->part].name;
st->snsrs[i].rrs = &bmi_hws[i].rrs[st->part];
bmi_max_range(st, i, st->snsrs[i].cfg.max_range.ival);
st->gis[i].dev_name = st->snsrs[i].cfg.name;
st->gis[i].gte = NULL;
st->snsrs[i].gis.dev_name = st->snsrs[i].cfg.name;
st->iio_init_done[i] = true;
st->snsrs[i].st = st;
init_completion(&st->snsrs[i].hte_ts_cmpl);
}
ret = bmi_setup_gpio(&st->i2c->dev, st, st->hw_n);
if (ret < 0)
return ret;
for (i = 0; i < st->hw_n; i++) {
desc = devm_kzalloc(&st->i2c->dev, sizeof(*desc)*BMI_HW_N, GFP_KERNEL);
if (!desc)
return -ENOMEM;
for (i = 0; i < BMI_HW_N; i++) {
if (bmi_hws[i].fn_irqflags) {
irqflags = bmi_hws[i].fn_irqflags(st);
ret = devm_request_threaded_irq(&st->i2c->dev,
st->gis[i].irq,
st->snsrs[i].gis.irq,
NULL,
bmi_irq_thread,
irqflags,
st->gis[i].dev_name,
st);
st->snsrs[i].gis.dev_name,
&st->snsrs[i]);
if (ret) {
dev_err(&st->i2c->dev,
"req_threaded_irq ERR %d\n", ret);
return ret;
}
}
ret = hte_init_line_attr(&desc[i], 0, 0, NULL,
st->snsrs[i].gis.gpio_in);
if (ret) {
dev_err(&st->i2c->dev,
"hte_init_line_attr ERR %d\n", ret);
return ret;
}
ret = hte_ts_get(&st->i2c->dev, &desc[i], i);
if (ret) {
dev_err(&st->i2c->dev,
"hte_ts_get ERR %d\n", ret);
return ret;
}
ret = devm_hte_request_ts_ns(&st->i2c->dev, &desc[i],
process_hw_ts, NULL,
&st->snsrs[i]);
if (ret) {
dev_err(&st->i2c->dev,
"devm_hte_request_ts_ns ERR %d\n", ret);
return ret;
}
}
/*
@@ -1614,20 +1494,11 @@ static int bmi_init(struct bmi_state *st, const struct i2c_device_id *id)
for (i = 0; i < st->hw_n; i++)
st->snsrs[i].period_us = st->snsrs[i].cfg.delay_us_max;
gte_nd = of_find_compatible_node(NULL, NULL, gte_hw_str_t194);
if (!gte_nd)
gte_nd = of_find_compatible_node(NULL, NULL, gte_hw_str_t234);
if (!gte_nd) {
dev_err(&st->i2c->dev, "Failed to find GTE node\n");
return -ENODEV;
}
return ret;
}
#if KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE
#if defined(NV_I2C_DRIVER_STRUCT_PROBE_WITHOUT_I2C_DEVICE_ID_ARG) /* Linux 6.3 */
static int bmi_probe(struct i2c_client *client)
#else
static int bmi_probe(struct i2c_client *client, const struct i2c_device_id *id)

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
// Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-FileCopyrightText: Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#include <linux/init.h>
#include <linux/module.h>
@@ -164,6 +164,9 @@ int bmi_iio_push_buf(struct iio_dev *indio_dev, unsigned char *data, u64 ts)
if (!indio_dev || !data)
return -EINVAL;
if (!indio_dev->active_scan_mask)
return -EINVAL;
st = iio_priv(indio_dev);
if (!st)
return -EINVAL;
@@ -201,8 +204,7 @@ static int bmi_iio_enable(struct iio_dev *indio_dev, bool en)
int bit;
if (!en)
return st->fn_dev->enable(st->client, st->cfg->snsr_id,
0, true);
return st->fn_dev->enable(st->client, st->cfg->snsr_id, 0);
if (indio_dev->num_channels > 1) {
for_each_set_bit(bit, indio_dev->active_scan_mask,
@@ -213,7 +215,7 @@ static int bmi_iio_enable(struct iio_dev *indio_dev, bool en)
}
return st->fn_dev->enable(st->client, st->cfg->snsr_id, enable, true);
return st->fn_dev->enable(st->client, st->cfg->snsr_id, enable);
}
static ssize_t bmi_iio_attr_store(struct device *dev,
@@ -350,7 +352,7 @@ static inline int bmi_iio_check_enable(struct bmi_iio_state *st)
if (!st->fn_dev->enable)
return -EINVAL;
return st->fn_dev->enable(st->client, st->cfg->snsr_id, -1, false);
return st->fn_dev->enable(st->client, st->cfg->snsr_id, -1);
}
static int bmi_iio_read_raw(struct iio_dev *indio_dev,

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
// Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-FileCopyrightText: Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#ifndef _BMI_IIO_H_
@@ -39,7 +39,7 @@ struct sensor_cfg {
struct iio_fn_dev {
unsigned int *sts;
int (*enable)(void *client, int snsr_id, int enable, bool is_gte);
int (*enable)(void *client, int snsr_id, int enable);
int (*freq_read)(void *client, int snsr_id, int *val, int *val2);
int (*freq_write)(void *client, int snsr_id, int val, int val2);
int (*scale_write)(void *client, int snsr_id, int val, int val2);

View File

@@ -1,7 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*/
// SPDX-License-Identifier: GPL-2.0-only
// SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#include <linux/clk-provider.h>
#include <linux/device.h>
@@ -366,7 +364,7 @@ static int tegra_bpmp_clk_get_info(struct tegra_bpmp *bpmp, unsigned int id,
if (err < 0)
return err;
strlcpy(info->name, response.name, MRQ_CLK_NAME_MAXLEN);
strscpy(info->name, response.name, MRQ_CLK_NAME_MAXLEN);
info->num_parents = response.num_parents;
for (i = 0; i < info->num_parents; i++)

View File

@@ -5,7 +5,9 @@ ifdef CONFIG_TEGRA_HOST1X
obj-m += tegra-hv-vse-safety.o
obj-m += tegra-nvvse-cryptodev.o
ifdef CONFIG_CRYPTO_ENGINE
ifndef CONFIG_SKIP_CRYPTO
obj-m += tegra/
endif
endif
endif
obj-m += tegra-se-nvrng.o

View File

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2019-2023, NVIDIA Corporation. All Rights Reserved.
* Copyright (c) 2019-2024, NVIDIA Corporation. All Rights Reserved.
*
* Cryptographic API.
*/
@@ -15,8 +15,8 @@
#include <linux/dma-mapping.h>
#include <linux/hw_random.h>
#include <linux/io.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/of_platform.h>
#include <linux/mutex.h>
#include <linux/types.h>
#include <linux/errno.h>

View File

@@ -1,9 +1,11 @@
// SPDX-License-Identifier: GPL-2.0-only
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-FileCopyrightText: Copyright (c) 2023-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
/*
* Crypto driver to handle block cipher algorithms using NVIDIA Security Engine.
*/
#include <nvidia/conftest.h>
#include <linux/clk.h>
#include <linux/dma-mapping.h>
#include <linux/host1x-next.h>
@@ -23,7 +25,9 @@
#include "tegra-se.h"
struct tegra_aes_ctx {
#ifndef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
struct crypto_engine_ctx enginectx;
#endif
struct tegra_se *se;
u32 alg;
u32 keylen;
@@ -41,7 +45,9 @@ struct tegra_aes_reqctx {
};
struct tegra_aead_ctx {
#ifndef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
struct crypto_engine_ctx enginectx;
#endif
struct tegra_se *se;
unsigned int authsize;
u32 alg;
@@ -66,7 +72,9 @@ struct tegra_aead_reqctx {
};
struct tegra_cmac_ctx {
#ifndef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
struct crypto_engine_ctx enginectx;
#endif
struct crypto_shash *fallback_tfm;
struct tegra_se *se;
unsigned int alg;
@@ -302,6 +310,12 @@ static int tegra_aes_do_one_req(struct crypto_engine *engine, void *areq)
struct tegra_se *se;
int ret;
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
ret = tegra_aes_prep_req(engine, areq);
if (ret != 0)
return ret;
#endif
req = container_of(areq, struct skcipher_request, base);
rctx = skcipher_request_ctx(req);
ctx = crypto_skcipher_ctx(crypto_skcipher_reqtfm(req));
@@ -336,6 +350,12 @@ static int tegra_aes_do_one_req(struct crypto_engine *engine, void *areq)
crypto_finalize_skcipher_request(se->engine, req, ret);
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
if (ret != 0)
return ret;
ret = tegra_aes_unprep_req(engine, areq);
#endif
return ret;
}
@@ -347,7 +367,11 @@ static int tegra_aes_cra_init(struct crypto_skcipher *tfm)
const char *algname;
int ret;
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
se_alg = container_of(alg, struct tegra_se_alg, alg.skcipher.base);
#else
se_alg = container_of(alg, struct tegra_se_alg, alg.skcipher);
#endif
crypto_skcipher_set_reqsize(tfm, sizeof(struct tegra_aes_reqctx));
@@ -364,9 +388,11 @@ static int tegra_aes_cra_init(struct crypto_skcipher *tfm)
}
ctx->alg = ret;
#ifndef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
ctx->enginectx.op.prepare_request = tegra_aes_prep_req;
ctx->enginectx.op.do_one_request = tegra_aes_do_one_req;
ctx->enginectx.op.unprepare_request = tegra_aes_unprep_req;
#endif
return 0;
}
@@ -494,6 +520,9 @@ static int tegra_aes_decrypt(struct skcipher_request *req)
static struct tegra_se_alg tegra_aes_algs[] = {
{
.alg.skcipher = {
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
.base = {
#endif
.init = tegra_aes_cra_init,
.exit = tegra_aes_cra_exit,
.setkey = tegra_xts_setkey,
@@ -514,9 +543,16 @@ static struct tegra_se_alg tegra_aes_algs[] = {
.cra_alignmask = 0,
.cra_module = THIS_MODULE,
},
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
},
.op.do_one_request = tegra_aes_do_one_req,
#endif
}
}, {
.alg.skcipher = {
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
.base = {
#endif
.init = tegra_aes_cra_init,
.exit = tegra_aes_cra_exit,
.setkey = tegra_aes_setkey,
@@ -537,9 +573,16 @@ static struct tegra_se_alg tegra_aes_algs[] = {
.cra_alignmask = 0,
.cra_module = THIS_MODULE,
},
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
},
.op.do_one_request = tegra_aes_do_one_req,
#endif
}
}, {
.alg.skcipher = {
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
.base = {
#endif
.init = tegra_aes_cra_init,
.exit = tegra_aes_cra_exit,
.setkey = tegra_aes_setkey,
@@ -560,9 +603,16 @@ static struct tegra_se_alg tegra_aes_algs[] = {
.cra_alignmask = 0,
.cra_module = THIS_MODULE,
},
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
},
.op.do_one_request = tegra_aes_do_one_req,
#endif
}
}, {
.alg.skcipher = {
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
.base = {
#endif
.init = tegra_aes_cra_init,
.exit = tegra_aes_cra_exit,
.setkey = tegra_aes_setkey,
@@ -583,9 +633,16 @@ static struct tegra_se_alg tegra_aes_algs[] = {
.cra_alignmask = 0,
.cra_module = THIS_MODULE,
},
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
},
.op.do_one_request = tegra_aes_do_one_req,
#endif
}
}, {
.alg.skcipher = {
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
.base = {
#endif
.init = tegra_aes_cra_init,
.exit = tegra_aes_cra_exit,
.setkey = tegra_aes_setkey,
@@ -606,6 +663,10 @@ static struct tegra_se_alg tegra_aes_algs[] = {
.cra_alignmask = 0,
.cra_module = THIS_MODULE,
},
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
},
.op.do_one_request = tegra_aes_do_one_req,
#endif
}
},
};
@@ -1189,6 +1250,11 @@ static int tegra_ccm_crypt_init(struct aead_request *req, struct tegra_se *se,
return 0;
}
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
static int tegra_aead_prep_req(struct crypto_engine *engine, void *areq);
static int tegra_aead_unprep_req(struct crypto_engine *engine, void *areq);
#endif
static int tegra_ccm_do_one_req(struct crypto_engine *engine, void *areq)
{
struct aead_request *req = container_of(areq, struct aead_request, base);
@@ -1198,6 +1264,12 @@ static int tegra_ccm_do_one_req(struct crypto_engine *engine, void *areq)
struct tegra_se *se = ctx->se;
int ret;
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
ret = tegra_aead_prep_req(engine, areq);
if (ret != 0)
return ret;
#endif
ret = tegra_ccm_crypt_init(req, se, rctx);
if (ret)
goto out;
@@ -1231,6 +1303,11 @@ static int tegra_ccm_do_one_req(struct crypto_engine *engine, void *areq)
out:
crypto_finalize_aead_request(se->engine, req, ret);
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
ret = tegra_aead_unprep_req(engine, areq);
if (ret != 0)
return ret;
#endif
return 0;
}
@@ -1242,6 +1319,12 @@ static int tegra_gcm_do_one_req(struct crypto_engine *engine, void *areq)
struct tegra_aead_reqctx *rctx = aead_request_ctx(req);
int ret;
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
ret = tegra_aead_prep_req(engine, areq);
if (ret != 0)
return ret;
#endif
req = container_of(areq, struct aead_request, base);
rctx->src_sg = req->src;
@@ -1281,6 +1364,11 @@ static int tegra_gcm_do_one_req(struct crypto_engine *engine, void *areq)
out:
crypto_finalize_aead_request(ctx->se->engine, req, ret);
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
ret = tegra_aead_unprep_req(engine, areq);
if (ret != 0)
return ret;
#endif
return 0;
}
@@ -1338,7 +1426,11 @@ static int tegra_ccm_cra_init(struct crypto_aead *tfm)
algname = crypto_tfm_alg_name(&tfm->base);
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
se_alg = container_of(alg, struct tegra_se_alg, alg.aead.base);
#else
se_alg = container_of(alg, struct tegra_se_alg, alg.aead);
#endif
crypto_aead_set_reqsize(tfm, sizeof(struct tegra_aead_reqctx));
@@ -1346,9 +1438,11 @@ static int tegra_ccm_cra_init(struct crypto_aead *tfm)
ctx->key_id = 0;
ctx->alg = se_algname_to_algid(algname);
#ifndef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
ctx->enginectx.op.prepare_request = tegra_aead_prep_req;
ctx->enginectx.op.do_one_request = tegra_ccm_do_one_req;
ctx->enginectx.op.unprepare_request = tegra_aead_unprep_req;
#endif
return 0;
}
@@ -1383,7 +1477,11 @@ static int tegra_gcm_cra_init(struct crypto_aead *tfm)
const char *algname;
algname = crypto_tfm_alg_name(&tfm->base);
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
se_alg = container_of(alg, struct tegra_se_alg, alg.aead.base);
#else
se_alg = container_of(alg, struct tegra_se_alg, alg.aead);
#endif
crypto_aead_set_reqsize(tfm, sizeof(struct tegra_aead_reqctx));
@@ -1391,9 +1489,11 @@ static int tegra_gcm_cra_init(struct crypto_aead *tfm)
ctx->key_id = 0;
ctx->alg = se_algname_to_algid(algname);
#ifndef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
ctx->enginectx.op.prepare_request = tegra_aead_prep_req;
ctx->enginectx.op.do_one_request = tegra_gcm_do_one_req;
ctx->enginectx.op.unprepare_request = tegra_aead_unprep_req;
#endif
return 0;
}
@@ -1637,7 +1737,11 @@ static int tegra_cmac_cra_init(struct crypto_tfm *tfm)
const char *algname;
algname = crypto_tfm_alg_name(tfm);
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
se_alg = container_of(alg, struct tegra_se_alg, alg.ahash.base);
#else
se_alg = container_of(alg, struct tegra_se_alg, alg.ahash);
#endif
crypto_ahash_set_reqsize(__crypto_ahash_cast(tfm),
sizeof(struct tegra_cmac_reqctx));
@@ -1645,9 +1749,11 @@ static int tegra_cmac_cra_init(struct crypto_tfm *tfm)
ctx->se = se_alg->se_dev;
ctx->key_id = 0;
ctx->alg = se_algname_to_algid(algname);
#ifndef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
ctx->enginectx.op.prepare_request = NULL;
ctx->enginectx.op.do_one_request = tegra_cmac_do_one_req;
ctx->enginectx.op.unprepare_request = NULL;
#endif
ctx->fallback_tfm = crypto_alloc_shash(algname, 0,
CRYPTO_ALG_NEED_FALLBACK);
@@ -1792,6 +1898,9 @@ static int tegra_cmac_import(struct ahash_request *req, const void *in)
static struct tegra_se_alg tegra_aead_algs[] = {
{
.alg.aead = {
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
.base = {
#endif
.init = tegra_gcm_cra_init,
.exit = tegra_aead_cra_exit,
.setkey = tegra_aead_setkey,
@@ -1809,9 +1918,16 @@ static struct tegra_se_alg tegra_aead_algs[] = {
.cra_alignmask = 0,
.cra_module = THIS_MODULE,
},
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
},
.op.do_one_request = tegra_gcm_do_one_req,
#endif
}
}, {
.alg.aead = {
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
.base = {
#endif
.init = tegra_ccm_cra_init,
.exit = tegra_aead_cra_exit,
.setkey = tegra_aead_setkey,
@@ -1830,6 +1946,10 @@ static struct tegra_se_alg tegra_aead_algs[] = {
.cra_alignmask = 0,
.cra_module = THIS_MODULE,
},
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
},
.op.do_one_request = tegra_ccm_do_one_req,
#endif
}
}
};
@@ -1837,6 +1957,9 @@ static struct tegra_se_alg tegra_aead_algs[] = {
static struct tegra_se_alg tegra_cmac_algs[] = {
{
.alg.ahash = {
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
.base = {
#endif
.init = tegra_cmac_init,
.setkey = tegra_cmac_setkey,
.update = tegra_cmac_update,
@@ -1859,7 +1982,11 @@ static struct tegra_se_alg tegra_cmac_algs[] = {
.cra_module = THIS_MODULE,
.cra_init = tegra_cmac_cra_init,
.cra_exit = tegra_cmac_cra_exit,
}
},
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
},
.op.do_one_request = tegra_cmac_do_one_req,
#endif
}
}
};
@@ -1872,30 +1999,45 @@ int tegra_init_aes(struct tegra_se *se)
for (i = 0; i < ARRAY_SIZE(tegra_aes_algs); i++) {
tegra_aes_algs[i].se_dev = se;
ret = crypto_register_skcipher(&tegra_aes_algs[i].alg.skcipher);
ret = CRYPTO_REGISTER(skcipher, &tegra_aes_algs[i].alg.skcipher);
if (ret) {
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
dev_err(se->dev, "failed to register %s\n",
tegra_aes_algs[i].alg.skcipher.base.base.cra_name);
#else
dev_err(se->dev, "failed to register %s\n",
tegra_aes_algs[i].alg.skcipher.base.cra_name);
#endif
goto err_aes;
}
}
for (i = 0; i < ARRAY_SIZE(tegra_aead_algs); i++) {
tegra_aead_algs[i].se_dev = se;
ret = crypto_register_aead(&tegra_aead_algs[i].alg.aead);
ret = CRYPTO_REGISTER(aead, &tegra_aead_algs[i].alg.aead);
if (ret) {
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
dev_err(se->dev, "failed to register %s\n",
tegra_aead_algs[i].alg.aead.base.base.cra_name);
#else
dev_err(se->dev, "failed to register %s\n",
tegra_aead_algs[i].alg.aead.base.cra_name);
#endif
goto err_aead;
}
}
for (i = 0; i < ARRAY_SIZE(tegra_cmac_algs); i++) {
tegra_cmac_algs[i].se_dev = se;
ret = crypto_register_ahash(&tegra_cmac_algs[i].alg.ahash);
ret = CRYPTO_REGISTER(ahash, &tegra_cmac_algs[i].alg.ahash);
if (ret) {
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
dev_err(se->dev, "failed to register %s\n",
tegra_cmac_algs[i].alg.ahash.halg.base.cra_name);
tegra_cmac_algs[i].alg.ahash.base.halg.base.cra_name);
#else
dev_err(se->dev, "failed to register %s\n",
tegra_cmac_algs[i].alg.ahash.halg.base.cra_name);
#endif
goto err_cmac;
}
}
@@ -1906,17 +2048,17 @@ int tegra_init_aes(struct tegra_se *se)
err_cmac:
for (--i; i >= 0; i--)
crypto_unregister_ahash(&tegra_cmac_algs[i].alg.ahash);
CRYPTO_UNREGISTER(ahash, &tegra_cmac_algs[i].alg.ahash);
i = ARRAY_SIZE(tegra_aead_algs);
err_aead:
for (--i; i >= 0; i--)
crypto_unregister_aead(&tegra_aead_algs[i].alg.aead);
CRYPTO_UNREGISTER(aead, &tegra_aead_algs[i].alg.aead);
i = ARRAY_SIZE(tegra_aes_algs);
err_aes:
for (--i; i >= 0; i--)
crypto_unregister_skcipher(&tegra_aes_algs[i].alg.skcipher);
CRYPTO_UNREGISTER(skcipher, &tegra_aes_algs[i].alg.skcipher);
return ret;
}
@@ -1926,12 +2068,12 @@ void tegra_deinit_aes(void)
int i;
for (i = 0; i < ARRAY_SIZE(tegra_aes_algs); i++)
crypto_unregister_skcipher(&tegra_aes_algs[i].alg.skcipher);
CRYPTO_UNREGISTER(skcipher, &tegra_aes_algs[i].alg.skcipher);
for (i = 0; i < ARRAY_SIZE(tegra_aead_algs); i++)
crypto_unregister_aead(&tegra_aead_algs[i].alg.aead);
CRYPTO_UNREGISTER(aead, &tegra_aead_algs[i].alg.aead);
for (i = 0; i < ARRAY_SIZE(tegra_cmac_algs); i++)
crypto_unregister_ahash(&tegra_cmac_algs[i].alg.ahash);
CRYPTO_UNREGISTER(ahash, &tegra_cmac_algs[i].alg.ahash);
}

View File

@@ -1,9 +1,10 @@
// SPDX-License-Identifier: GPL-2.0-only
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-FileCopyrightText: Copyright (c) 2023-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
/*
* Crypto driver to handle HASH algorithms using NVIDIA Security Engine.
*/
#include <nvidia/conftest.h>
#include <linux/clk.h>
#include <linux/dma-mapping.h>
#include <linux/host1x-next.h>
@@ -23,7 +24,9 @@
#include "tegra-se.h"
struct tegra_sha_ctx {
#ifndef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
struct crypto_engine_ctx enginectx;
#endif
struct crypto_ahash *fallback_tfm;
struct tegra_se *se;
unsigned int alg;
@@ -414,7 +417,11 @@ static int tegra_sha_cra_init(struct crypto_tfm *tfm)
const char *algname;
algname = crypto_tfm_alg_name(tfm);
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
se_alg = container_of(alg, struct tegra_se_alg, alg.ahash.base);
#else
se_alg = container_of(alg, struct tegra_se_alg, alg.ahash);
#endif
crypto_ahash_set_reqsize(__crypto_ahash_cast(tfm),
sizeof(struct tegra_sha_reqctx));
@@ -423,9 +430,11 @@ static int tegra_sha_cra_init(struct crypto_tfm *tfm)
ctx->fallback = false;
ctx->key_id = 0;
ctx->alg = se_algname_to_algid(algname);
#ifndef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
ctx->enginectx.op.prepare_request = NULL;
ctx->enginectx.op.do_one_request = tegra_sha_do_one_req;
ctx->enginectx.op.unprepare_request = NULL;
#endif
if (se_alg->alg_base)
tegra_sha_init_fallback(ctx, algname);
@@ -492,7 +501,7 @@ digbuf_fail:
return -ENOMEM;
}
int tegra_hmac_fallback_setkey(struct tegra_sha_ctx *ctx, const u8 *key,
static int tegra_hmac_fallback_setkey(struct tegra_sha_ctx *ctx, const u8 *key,
unsigned int keylen)
{
if (!ctx->fallback_tfm) {
@@ -608,6 +617,9 @@ static int tegra_sha_import(struct ahash_request *req, const void *in)
static struct tegra_se_alg tegra_hash_algs[] = {
{
.alg.ahash = {
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
.base = {
#endif
.init = tegra_sha_init,
.update = tegra_sha_update,
.final = tegra_sha_final,
@@ -630,9 +642,16 @@ static struct tegra_se_alg tegra_hash_algs[] = {
.cra_init = tegra_sha_cra_init,
.cra_exit = tegra_sha_cra_exit,
}
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
},
.op.do_one_request = tegra_sha_do_one_req,
#endif
}
}, {
.alg.ahash = {
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
.base = {
#endif
.init = tegra_sha_init,
.update = tegra_sha_update,
.final = tegra_sha_final,
@@ -655,9 +674,16 @@ static struct tegra_se_alg tegra_hash_algs[] = {
.cra_init = tegra_sha_cra_init,
.cra_exit = tegra_sha_cra_exit,
}
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
},
.op.do_one_request = tegra_sha_do_one_req,
#endif
}
}, {
.alg.ahash = {
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
.base = {
#endif
.init = tegra_sha_init,
.update = tegra_sha_update,
.final = tegra_sha_final,
@@ -680,9 +706,16 @@ static struct tegra_se_alg tegra_hash_algs[] = {
.cra_init = tegra_sha_cra_init,
.cra_exit = tegra_sha_cra_exit,
}
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
},
.op.do_one_request = tegra_sha_do_one_req,
#endif
}
}, {
.alg.ahash = {
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
.base = {
#endif
.init = tegra_sha_init,
.update = tegra_sha_update,
.final = tegra_sha_final,
@@ -705,9 +738,16 @@ static struct tegra_se_alg tegra_hash_algs[] = {
.cra_init = tegra_sha_cra_init,
.cra_exit = tegra_sha_cra_exit,
}
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
},
.op.do_one_request = tegra_sha_do_one_req,
#endif
}
}, {
.alg.ahash = {
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
.base = {
#endif
.init = tegra_sha_init,
.update = tegra_sha_update,
.final = tegra_sha_final,
@@ -730,9 +770,16 @@ static struct tegra_se_alg tegra_hash_algs[] = {
.cra_init = tegra_sha_cra_init,
.cra_exit = tegra_sha_cra_exit,
}
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
},
.op.do_one_request = tegra_sha_do_one_req,
#endif
}
}, {
.alg.ahash = {
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
.base = {
#endif
.init = tegra_sha_init,
.update = tegra_sha_update,
.final = tegra_sha_final,
@@ -755,9 +802,16 @@ static struct tegra_se_alg tegra_hash_algs[] = {
.cra_init = tegra_sha_cra_init,
.cra_exit = tegra_sha_cra_exit,
}
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
},
.op.do_one_request = tegra_sha_do_one_req,
#endif
}
}, {
.alg.ahash = {
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
.base = {
#endif
.init = tegra_sha_init,
.update = tegra_sha_update,
.final = tegra_sha_final,
@@ -780,9 +834,16 @@ static struct tegra_se_alg tegra_hash_algs[] = {
.cra_init = tegra_sha_cra_init,
.cra_exit = tegra_sha_cra_exit,
}
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
},
.op.do_one_request = tegra_sha_do_one_req,
#endif
}
}, {
.alg.ahash = {
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
.base = {
#endif
.init = tegra_sha_init,
.update = tegra_sha_update,
.final = tegra_sha_final,
@@ -805,9 +866,16 @@ static struct tegra_se_alg tegra_hash_algs[] = {
.cra_init = tegra_sha_cra_init,
.cra_exit = tegra_sha_cra_exit,
}
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
},
.op.do_one_request = tegra_sha_do_one_req,
#endif
}
}, {
.alg.ahash = {
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
.base = {
#endif
.init = tegra_sha_init,
.update = tegra_sha_update,
.final = tegra_sha_final,
@@ -830,10 +898,17 @@ static struct tegra_se_alg tegra_hash_algs[] = {
.cra_init = tegra_sha_cra_init,
.cra_exit = tegra_sha_cra_exit,
}
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
},
.op.do_one_request = tegra_sha_do_one_req,
#endif
}
}, {
.alg_base = "sha224",
.alg.ahash = {
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
.base = {
#endif
.init = tegra_sha_init,
.update = tegra_sha_update,
.final = tegra_sha_final,
@@ -857,10 +932,17 @@ static struct tegra_se_alg tegra_hash_algs[] = {
.cra_init = tegra_sha_cra_init,
.cra_exit = tegra_sha_cra_exit,
}
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
},
.op.do_one_request = tegra_sha_do_one_req,
#endif
}
}, {
.alg_base = "sha256",
.alg.ahash = {
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
.base = {
#endif
.init = tegra_sha_init,
.update = tegra_sha_update,
.final = tegra_sha_final,
@@ -884,10 +966,17 @@ static struct tegra_se_alg tegra_hash_algs[] = {
.cra_init = tegra_sha_cra_init,
.cra_exit = tegra_sha_cra_exit,
}
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
},
.op.do_one_request = tegra_sha_do_one_req,
#endif
}
}, {
.alg_base = "sha384",
.alg.ahash = {
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
.base = {
#endif
.init = tegra_sha_init,
.update = tegra_sha_update,
.final = tegra_sha_final,
@@ -911,10 +1000,17 @@ static struct tegra_se_alg tegra_hash_algs[] = {
.cra_init = tegra_sha_cra_init,
.cra_exit = tegra_sha_cra_exit,
}
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
},
.op.do_one_request = tegra_sha_do_one_req,
#endif
}
}, {
.alg_base = "sha512",
.alg.ahash = {
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
.base = {
#endif
.init = tegra_sha_init,
.update = tegra_sha_update,
.final = tegra_sha_final,
@@ -938,6 +1034,10 @@ static struct tegra_se_alg tegra_hash_algs[] = {
.cra_init = tegra_sha_cra_init,
.cra_exit = tegra_sha_cra_exit,
}
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
},
.op.do_one_request = tegra_sha_do_one_req,
#endif
}
}
};
@@ -984,10 +1084,15 @@ int tegra_init_hash(struct tegra_se *se)
for (i = 0; i < ARRAY_SIZE(tegra_hash_algs); i++) {
tegra_hash_algs[i].se_dev = se;
ret = crypto_register_ahash(&tegra_hash_algs[i].alg.ahash);
ret = CRYPTO_REGISTER(ahash, &tegra_hash_algs[i].alg.ahash);
if (ret) {
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
dev_err(se->dev, "failed to register %s\n",
tegra_hash_algs[i].alg.ahash.halg.base.cra_name);
tegra_hash_algs[i].alg.ahash.base.halg.base.cra_name);
#else
dev_err(se->dev, "failed to register %s\n",
tegra_hash_algs[i].alg.ahash.halg.base.cra_name);
#endif
goto sha_err;
}
}
@@ -998,7 +1103,7 @@ int tegra_init_hash(struct tegra_se *se)
sha_err:
for (--i; i >= 0; i--)
crypto_unregister_ahash(&tegra_hash_algs[i].alg.ahash);
CRYPTO_UNREGISTER(ahash, &tegra_hash_algs[i].alg.ahash);
return ret;
}
@@ -1009,5 +1114,5 @@ void tegra_deinit_hash(void)
int i;
for (i = 0; i < ARRAY_SIZE(tegra_hash_algs); i++)
crypto_unregister_ahash(&tegra_hash_algs[i].alg.ahash);
CRYPTO_UNREGISTER(ahash, &tegra_hash_algs[i].alg.ahash);
}

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-FileCopyrightText: Copyright (c) 2023-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
/*
* Header file for NVIDIA Security Engine driver.
*/
@@ -18,6 +18,9 @@
#include <crypto/sm3.h>
#include <crypto/skcipher.h>
#include <nvidia/conftest.h>
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
#include <crypto/engine.h>
#endif
#define SE_MAX_INSTANCES 3
#define SE_OWNERSHIP 0x14
@@ -359,6 +362,21 @@
#define SHA_UPDATE BIT(1)
#define SHA_FINAL BIT(2)
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
#define CRYPTO_REGISTER(alg, x) \
crypto_engine_register_##alg(x)
#else
#define CRYPTO_REGISTER(alg, x) \
crypto_register_##alg(x)
#endif
#ifdef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
#define CRYPTO_UNREGISTER(alg, x) \
crypto_engine_unregister_##alg(x)
#else
#define CRYPTO_UNREGISTER(alg, x) \
crypto_unregister_##alg(x)
#endif
/* Security Engine operation modes */
enum se_aes_alg {
@@ -398,9 +416,15 @@ struct tegra_se_alg {
const char *alg_base;
union {
#ifndef NV_CONFTEST_REMOVE_STRUCT_CRYPTO_ENGINE_CTX
struct skcipher_alg skcipher;
struct aead_alg aead;
struct ahash_alg ahash;
#else
struct skcipher_engine_alg skcipher;
struct aead_engine_alg aead;
struct ahash_engine_alg ahash;
#endif
} alg;
};

View File

@@ -1,16 +1,14 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# Makefile for Extended IVC Driver and BPMP driver
#
obj-m += ivc_ext.o
ifneq ($(CONFIG_TEGRA_IVC_LEGACY_DISABLE),y)
tegra_bpmp-y += ../../clk/tegra/clk-bpmp.o
tegra_bpmp-y += ../../reset/tegra/reset-bpmp.o
tegra_bpmp-y += ../../soc/tegra/powergate-bpmp.o
tegra_bpmp-$(CONFIG_DEBUG_FS) += bpmp-debugfs.o
tegra_bpmp-y += bpmp-tegra186-hv.o
obj-m += tegra_bpmp.o
endif
obj-m += tegra_bpmp.o

View File

@@ -1,8 +1,10 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*/
#include <nvidia/conftest.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_address.h>
@@ -82,7 +84,11 @@ static void tegra_bpmp_handle_mrq(struct tegra_bpmp *bpmp,
static void tegra_bpmp_channel_signal(struct tegra_bpmp_channel *channel)
{
#if defined(NV_TEGRA_IVC_STRUCT_HAS_IOSYS_MAP)
unsigned long flags = tegra_bpmp_mb_read_field(&channel->ob, flags);
#else
unsigned long flags = channel->ob->flags;
#endif
if ((flags & MSG_RING) == 0)
return;
@@ -116,8 +122,15 @@ void tegra_bpmp_handle_rx(struct tegra_bpmp *bpmp)
/* If supported incoming channel */
if (bpmp->soc->channels.cpu_rx.count == MAX_POSSIBLE_RX_CHANNEL) {
#if defined(NV_TEGRA_IVC_STRUCT_HAS_IOSYS_MAP)
if (tegra_bpmp_is_request_ready(channel)) {
unsigned int mrq = tegra_bpmp_mb_read_field(&channel->ib, code);
tegra_bpmp_handle_mrq(bpmp, mrq, channel);
}
#else
if (tegra_bpmp_is_request_ready(channel))
tegra_bpmp_handle_mrq(bpmp, channel->ib->code, channel);
#endif
}
spin_lock(&bpmp->lock);
@@ -198,12 +211,20 @@ static bool tegra186_bpmp_hv_is_message_ready(struct tegra_bpmp_channel *channel
void *frame;
frame = tegra_hv_ivc_read_get_next_frame(hv_ivc);
#if defined(NV_TEGRA_IVC_STRUCT_HAS_IOSYS_MAP)
if (IS_ERR(frame)) {
iosys_map_clear(&channel->ib);
return false;
}
iosys_map_set_vaddr(&channel->ib, frame);
#else
if (IS_ERR(frame)) {
channel->ib = NULL;
return false;
}
channel->ib = frame;
#endif
return true;
}
@@ -221,12 +242,20 @@ static bool tegra186_hv_bpmp_is_channel_free(struct tegra_bpmp_channel *channel)
void *frame;
frame = tegra_hv_ivc_write_get_next_frame(hv_ivc);
#if defined(NV_TEGRA_IVC_STRUCT_HAS_IOSYS_MAP)
if (IS_ERR(frame)) {
iosys_map_clear(&channel->ob);
return false;
}
iosys_map_set_vaddr(&channel->ob, frame);
#else
if (IS_ERR(frame)) {
channel->ob = NULL;
return false;
}
channel->ob = frame;
#endif
return true;
}
@@ -432,13 +461,23 @@ static void tegra_bpmp_mrq_handle_ping(unsigned int mrq,
struct tegra_bpmp_channel *channel,
void *data)
{
struct mrq_ping_request *request;
struct mrq_ping_response response;
#if defined(NV_TEGRA_IVC_STRUCT_HAS_IOSYS_MAP)
struct mrq_ping_request request;
tegra_bpmp_mb_read(&request, &channel->ib, sizeof(request));
memset(&response, 0, sizeof(response));
response.reply = request.challenge << 1;
#else
struct mrq_ping_request *request;
request = (struct mrq_ping_request *)channel->ib->data;
memset(&response, 0, sizeof(response));
response.reply = request->challenge << 1;
#endif
tegra_bpmp_mrq_return(channel, 0, &response, sizeof(response));
}

View File

@@ -1,11 +1,11 @@
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (c) 2022-2023, NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2022-2024, NVIDIA CORPORATION. All rights reserved.
ccflags-$(CONFIG_DRM_TEGRA_DEBUG) += -DDEBUG
ccflags-y += -I$(srctree.nvidia-oot)/drivers/gpu/drm/tegra/include
ccflags-y += -I$(srctree.hwpm)/include
tegra-drm-next-y := \
tegra-drm-y := \
drm.o \
uapi.o \
submit.o \
@@ -37,6 +37,6 @@ tegra-drm-next-y := \
ofa.o \
virt.o
tegra-drm-next-y += trace.o
tegra-drm-y += trace.o
obj-m := tegra-drm-next.o
obj-m := tegra-drm.o

View File

@@ -4,6 +4,8 @@
* Copyright (C) 2012 NVIDIA CORPORATION. All rights reserved.
*/
#include <nvidia/conftest.h>
#include <linux/clk.h>
#include <linux/debugfs.h>
#include <linux/delay.h>
@@ -12,6 +14,7 @@
#include <linux/interconnect.h>
#include <linux/module.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/pm_domain.h>
#include <linux/pm_opp.h>
#include <linux/pm_runtime.h>
@@ -1747,7 +1750,19 @@ static void tegra_dc_early_unregister(struct drm_crtc *crtc)
struct drm_minor *minor = crtc->dev->primary;
struct tegra_dc *dc = to_tegra_dc(crtc);
#if defined(NV_DRM_DEBUGFS_REMOVE_FILES_HAS_ROOT_ARG) /* Linux v6.7 */
struct dentry *root;
#ifdef CONFIG_DEBUG_FS
root = crtc->debugfs_entry;
#else
root = NULL;
#endif
drm_debugfs_remove_files(dc->debugfs_files, count, root, minor);
#else
drm_debugfs_remove_files(dc->debugfs_files, count, minor);
#endif
kfree(dc->debugfs_files);
dc->debugfs_files = NULL;
}

View File

@@ -11,6 +11,7 @@
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/pinctrl/pinconf-generic.h>
#include <linux/pinctrl/pinctrl.h>
#include <linux/pinctrl/pinmux.h>

View File

@@ -26,6 +26,7 @@
#include <drm/drm_ioctl.h>
#include <drm/drm_prime.h>
#include <drm/drm_vblank.h>
#include <drm/tegra_drm-next.h>
#if IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU)
#include <asm/dma-iommu.h>
@@ -891,8 +892,10 @@ static const struct drm_driver tegra_drm_driver = {
.debugfs_init = tegra_debugfs_init,
#endif
#if !defined(NV_UNEXPORT_FD_HANDLE_CONVERSION)
#if NV_IS_EXPORT_SYMBOL_PRESENT_drm_gem_prime_handle_to_fd
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
#endif
#if NV_IS_EXPORT_SYMBOL_PRESENT_drm_gem_prime_fd_to_handle
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
#endif
.gem_prime_import = tegra_gem_prime_import,

View File

@@ -3,6 +3,8 @@
* Copyright (C) 2013 NVIDIA Corporation
*/
#include <nvidia/conftest.h>
#include <linux/clk.h>
#include <linux/debugfs.h>
#include <linux/delay.h>
@@ -255,8 +257,14 @@ static void tegra_dsi_early_unregister(struct drm_connector *connector)
unsigned int count = ARRAY_SIZE(debugfs_files);
struct tegra_dsi *dsi = to_dsi(output);
#if defined(NV_DRM_DEBUGFS_REMOVE_FILES_HAS_ROOT_ARG) /* Linux v6.7 */
drm_debugfs_remove_files(dsi->debugfs_files, count,
connector->debugfs_entry,
connector->dev->primary);
#else
drm_debugfs_remove_files(dsi->debugfs_files, count,
connector->dev->primary);
#endif
kfree(dsi->debugfs_files);
dsi->debugfs_files = NULL;
}

View File

@@ -11,10 +11,7 @@
#include <linux/console.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 5, 0)
#include <linux/fb.h>
#endif
#include <drm/drm_fourcc.h>
#include <drm/drm_framebuffer.h>
@@ -214,24 +211,21 @@ static int tegra_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
return __tegra_gem_mmap(&bo->gem, vma);
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 5, 0)
#if defined(NV_FB_DEFERRED_IO_OPS_RENAME)
FB_GEN_DEFAULT_DEFERRED_IOMEM_OPS(tegra_fb,
drm_fb_helper_damage_range,
drm_fb_helper_damage_area)
#else
FB_GEN_DEFAULT_DEFERRED_IO_OPS(tegra_fb,
drm_fb_helper_damage_range,
drm_fb_helper_damage_area)
#endif
#endif
static const struct fb_ops tegra_fb_ops = {
.owner = THIS_MODULE,
#if defined(__FB_DEFAULT_DMAMEM_OPS_RDWR) /* Linux v6.6 */
__FB_DEFAULT_DMAMEM_OPS_RDWR,
#elif defined(__FB_DEFAULT_SYS_OPS_RDWR) /* Linux v6.5 */
__FB_DEFAULT_SYS_OPS_RDWR,
#else
.fb_read = drm_fb_helper_sys_read,
.fb_write = drm_fb_helper_sys_write,
#endif
DRM_FB_HELPER_DEFAULT_OPS,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 5, 0)
__FB_DEFAULT_DEFERRED_OPS_RDWR(tegra_fb),
__FB_DEFAULT_DEFERRED_OPS_DRAW(tegra_fb),
#if defined(__FB_DEFAULT_DMAMEM_OPS_DRAW) /* Linux v6.6 */
__FB_DEFAULT_DMAMEM_OPS_DRAW,
#elif defined(__FB_DEFAULT_SYS_OPS_DRAW) /* Linux v6.5 */
__FB_DEFAULT_SYS_OPS_DRAW,
#else
.fb_fillrect = drm_fb_helper_sys_fillrect,
.fb_copyarea = drm_fb_helper_sys_copyarea,

View File

@@ -15,7 +15,6 @@
#include <linux/dma-buf.h>
#include <linux/iommu.h>
#include <linux/module.h>
#include <linux/version.h>
#include <drm/drm_drv.h>
#include <drm/drm_prime.h>
@@ -584,8 +583,7 @@ int __tegra_gem_mmap(struct drm_gem_object *gem, struct vm_area_struct *vma)
* and set the vm_pgoff (used as a fake buffer offset by DRM)
* to 0 as we want to map the whole buffer.
*/
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)) \
|| (defined(CONFIG_TEGRA_SYSTEM_TYPE_ACK) && (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)))
#if defined(NV_VM_AREA_STRUCT_HAS_CONST_VM_FLAGS) /* Linux v6.3 */
vm_flags_clear(vma, VM_PFNMAP);
#else
vma->vm_flags &= ~VM_PFNMAP;
@@ -603,8 +601,7 @@ int __tegra_gem_mmap(struct drm_gem_object *gem, struct vm_area_struct *vma)
} else {
pgprot_t prot = vm_get_page_prot(vma->vm_flags);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)) \
|| (defined(CONFIG_TEGRA_SYSTEM_TYPE_ACK) && (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)))
#if defined(NV_VM_AREA_STRUCT_HAS_CONST_VM_FLAGS) /* Linux v6.3 */
vm_flags_set(vma, VM_MIXEDMAP);
vm_flags_clear(vma, VM_PFNMAP);
#else
@@ -727,7 +724,6 @@ static int tegra_gem_prime_vmap(struct dma_buf *buf, struct iosys_map *map)
{
struct drm_gem_object *gem = buf->priv;
struct tegra_bo *bo = to_tegra_bo(gem);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)
void *vaddr;
vaddr = tegra_bo_mmap(&bo->base);
@@ -735,21 +731,16 @@ static int tegra_gem_prime_vmap(struct dma_buf *buf, struct iosys_map *map)
return PTR_ERR(vaddr);
iosys_map_set_vaddr(map, vaddr);
#else
iosys_map_set_vaddr(map, bo->vaddr);
#endif
return 0;
}
static void tegra_gem_prime_vunmap(struct dma_buf *buf, struct iosys_map *map)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)
struct drm_gem_object *gem = buf->priv;
struct tegra_bo *bo = to_tegra_bo(gem);
tegra_bo_munmap(&bo->base, map->vaddr);
#endif
}
#else
static int tegra_gem_prime_vmap(struct dma_buf *buf, struct dma_buf_map *map)

View File

@@ -8,9 +8,9 @@
#include <linux/iommu.h>
#include <linux/module.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/reset.h>
#include <linux/version.h>
#include <soc/tegra/common.h>
@@ -272,7 +272,7 @@ static int gr2d_probe(struct platform_device *pdev)
gr2d->client.version = gr2d->soc->version;
gr2d->client.ops = &gr2d_ops;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0)
#if defined(NV_DEVM_TEGRA_CORE_DEV_INIT_OPP_TABLE_COMMON_PRESENT) /* Linux v5.17 */
err = devm_tegra_core_dev_init_opp_table_common(dev);
if (err)
return err;

View File

@@ -530,7 +530,7 @@ static int gr3d_probe(struct platform_device *pdev)
gr3d->client.version = gr3d->soc->version;
gr3d->client.ops = &gr3d_ops;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0)
#if defined(NV_DEVM_TEGRA_CORE_DEV_INIT_OPP_TABLE_COMMON_PRESENT) /* Linux v5.17 */
err = devm_tegra_core_dev_init_opp_table_common(&pdev->dev);
if (err)
return err;

View File

@@ -4,6 +4,8 @@
* Copyright (C) 2012 NVIDIA CORPORATION. All rights reserved.
*/
#include <nvidia/conftest.h>
#include <linux/clk.h>
#include <linux/debugfs.h>
#include <linux/delay.h>
@@ -23,6 +25,9 @@
#include <drm/drm_atomic_helper.h>
#include <drm/drm_crtc.h>
#include <drm/drm_debugfs.h>
#if defined(NV_DRM_DRM_ELD_H_PRESENT)
#include <drm/drm_eld.h>
#endif
#include <drm/drm_file.h>
#include <drm/drm_fourcc.h>
#include <drm/drm_probe_helper.h>
@@ -1122,7 +1127,12 @@ static void tegra_hdmi_early_unregister(struct drm_connector *connector)
unsigned int count = ARRAY_SIZE(debugfs_files);
struct tegra_hdmi *hdmi = to_hdmi(output);
#if defined(NV_DRM_DEBUGFS_REMOVE_FILES_HAS_ROOT_ARG) /* Linux v6.7 */
drm_debugfs_remove_files(hdmi->debugfs_files, count,
connector->debugfs_entry, minor);
#else
drm_debugfs_remove_files(hdmi->debugfs_files, count, minor);
#endif
kfree(hdmi->debugfs_files);
hdmi->debugfs_files = NULL;
}
@@ -1864,16 +1874,14 @@ static int tegra_hdmi_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, hdmi);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0)
err = devm_pm_runtime_enable(&pdev->dev);
if (err)
return err;
#if defined(NV_DEVM_TEGRA_CORE_DEV_INIT_OPP_TABLE_COMMON_PRESENT) /* Linux v5.17 */
err = devm_tegra_core_dev_init_opp_table_common(&pdev->dev);
if (err)
return err;
#else
pm_runtime_enable(&pdev->dev);
#endif
INIT_LIST_HEAD(&hdmi->client.list);
@@ -1894,10 +1902,6 @@ static int tegra_hdmi_remove(struct platform_device *pdev)
{
struct tegra_hdmi *hdmi = platform_get_drvdata(pdev);
#if !(LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0))
pm_runtime_disable(&pdev->dev);
#endif
host1x_client_unregister(&hdmi->client);
tegra_output_remove(&hdmi->output);

View File

@@ -8,9 +8,9 @@
#include <linux/dma-mapping.h>
#include <linux/host1x-next.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/of_graph.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/reset.h>

View File

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* SPDX-FileCopyrightText: Copyright (c) 2015-2023, NVIDIA CORPORATION & AFFILIATES. All Rights Reserved.
* SPDX-FileCopyrightText: Copyright (c) 2015-2024, NVIDIA CORPORATION & AFFILIATES. All Rights Reserved.
*/
#include <linux/bitops.h>
@@ -108,7 +108,7 @@ static int nvdec_set_rate(struct nvdec *nvdec, unsigned long rate)
if (nvdec->icc_write) {
emc_kbps = dev_rate * NVDEC_AXI_RW_BANDWIDTH / 1024;
err = icc_set_bw(nvdec->icc_write, kbps_to_icc(emc_kbps), 0);
err = icc_set_bw(nvdec->icc_write, 0, kbps_to_icc(emc_kbps));
if (err)
dev_warn(nvdec->dev, "failed to set icc bw: %d\n", err);
}
@@ -804,10 +804,9 @@ static int nvdec_probe(struct platform_device *pdev)
}
nvdec->icc_write = devm_of_icc_get(dev, "write");
if (IS_ERR(nvdec->icc_write)) {
dev_err(&pdev->dev, "failed to get icc write handle\n");
return PTR_ERR(nvdec->icc_write);
}
if (IS_ERR(nvdec->icc_write))
return dev_err_probe(&pdev->dev, PTR_ERR(nvdec->icc_write),
"failed to get icc write handle\n");
platform_set_drvdata(pdev, nvdec);

View File

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* SPDX-FileCopyrightText: Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All Rights Reserved.
* SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All Rights Reserved.
*/
#include <linux/bitops.h>
@@ -91,7 +91,7 @@ static int nvenc_set_rate(struct nvenc *nvenc, unsigned long rate)
if (nvenc->icc_write) {
emc_kbps = dev_rate * NVENC_AXI_RW_BANDWIDTH / 1024;
err = icc_set_bw(nvenc->icc_write, kbps_to_icc(emc_kbps), 0);
err = icc_set_bw(nvenc->icc_write, 0, kbps_to_icc(emc_kbps));
if (err)
dev_warn(nvenc->dev, "failed to set icc bw: %d\n", err);
}
@@ -670,10 +670,9 @@ static int nvenc_probe(struct platform_device *pdev)
return err;
nvenc->icc_write = devm_of_icc_get(dev, "write");
if (IS_ERR(nvenc->icc_write)) {
dev_err(&pdev->dev, "failed to get icc write handle\n");
return PTR_ERR(nvenc->icc_write);
}
if (IS_ERR(nvenc->icc_write))
return dev_err_probe(&pdev->dev, PTR_ERR(nvenc->icc_write),
"failed to get icc write handle\n");
platform_set_drvdata(pdev, nvenc);

View File

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All Rights Reserved.
* SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All Rights Reserved.
*/
#include <linux/bitops.h>
@@ -88,7 +88,7 @@ static int nvjpg_set_rate(struct nvjpg *nvjpg, unsigned long rate)
if (nvjpg->icc_write) {
emc_kbps = dev_rate * NVJPG_AXI_RW_BANDWIDTH / 1024;
err = icc_set_bw(nvjpg->icc_write, kbps_to_icc(emc_kbps), 0);
err = icc_set_bw(nvjpg->icc_write, 0, kbps_to_icc(emc_kbps));
if (err)
dev_warn(nvjpg->dev, "failed to set icc bw: %d\n", err);
}
@@ -655,10 +655,9 @@ static int nvjpg_probe(struct platform_device *pdev)
return err;
nvjpg->icc_write = devm_of_icc_get(dev, "write");
if (IS_ERR(nvjpg->icc_write)) {
dev_err(&pdev->dev, "failed to get icc write handle\n");
return PTR_ERR(nvjpg->icc_write);
}
if (IS_ERR(nvjpg->icc_write))
return dev_err_probe(&pdev->dev, PTR_ERR(nvjpg->icc_write),
"failed to get icc write handle\n");
platform_set_drvdata(pdev, nvjpg);

View File

@@ -32,6 +32,9 @@
#endif
#include <drm/drm_atomic_helper.h>
#include <drm/drm_debugfs.h>
#if defined(NV_DRM_DRM_ELD_H_PRESENT)
#include <drm/drm_eld.h>
#endif
#include <drm/drm_file.h>
#include <drm/drm_panel.h>
#include <drm/drm_simple_kms_helper.h>
@@ -1718,8 +1721,15 @@ static void tegra_sor_early_unregister(struct drm_connector *connector)
unsigned int count = ARRAY_SIZE(debugfs_files);
struct tegra_sor *sor = to_sor(output);
#if defined(NV_DRM_DEBUGFS_REMOVE_FILES_HAS_ROOT_ARG) /* Linux v6.7 */
drm_debugfs_remove_files(sor->debugfs_files, count,
connector->debugfs_entry,
connector->dev->primary);
#else
drm_debugfs_remove_files(sor->debugfs_files, count,
connector->dev->primary);
#endif
kfree(sor->debugfs_files);
sor->debugfs_files = NULL;
}

View File

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* SPDX-FileCopyrightText: Copyright (C) 2015-2023 NVIDIA CORPORATION. All rights reserved.
* SPDX-FileCopyrightText: Copyright (C) 2015-2024 NVIDIA CORPORATION. All rights reserved.
*/
#include <linux/bitops.h>
@@ -129,7 +129,7 @@ static int vic_set_rate(struct vic *vic, unsigned long rate)
if (vic->icc_write) {
emc_kbps = dev_rate * VIC_AXI_RW_BANDWIDTH / 1024;
err = icc_set_bw(vic->icc_write, kbps_to_icc(emc_kbps), 0);
err = icc_set_bw(vic->icc_write, 0, kbps_to_icc(emc_kbps));
if (err)
dev_warn(vic->dev, "failed to set icc bw: %d\n", err);
}
@@ -723,10 +723,9 @@ static int vic_probe(struct platform_device *pdev)
}
vic->icc_write = devm_of_icc_get(dev, "write");
if (IS_ERR(vic->icc_write)) {
dev_err(&pdev->dev, "failed to get icc write handle\n");
return PTR_ERR(vic->icc_write);
}
if (IS_ERR(vic->icc_write))
return dev_err_probe(&pdev->dev, PTR_ERR(vic->icc_write),
"failed to get icc write handle\n");
if (!dev->pm_domain) {
vic->rst = devm_reset_control_get(dev, "vic");

View File

@@ -2,7 +2,7 @@
/*
* Host1x fence UAPI
*
* Copyright (c) 2022-2023, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2022-2024, NVIDIA CORPORATION. All rights reserved.
*/
#include <nvidia/conftest.h>
@@ -14,7 +14,8 @@
#include <linux/host1x-next.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/poll.h>
#include <linux/slab.h>
#include <linux/sync_file.h>

View File

@@ -1,7 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2022-2023, NVIDIA Corporation. All rights reserved.
*/
// SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES. All Rights Reserved.
#include <nvidia/conftest.h>
@@ -545,7 +543,6 @@ int flcn_intr_init(struct platform_device *pdev)
return -ENXIO;
}
spin_lock_init(&pdata->mirq_lock);
ret = devm_request_irq(&pdev->dev, pdata->irq, flcn_isr, 0,
dev_name(&pdev->dev), pdev);
if (ret) {

View File

@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (c) 2022-2023, NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2022-2024, NVIDIA CORPORATION. All rights reserved.
host1x-next-y = \
host1x-y = \
bus.o \
syncpt.o \
dev.o \
@@ -21,7 +21,7 @@ host1x-next-y = \
hw/host1x07.o \
hw/host1x08.o
host1x-next-$(CONFIG_IOMMU_API) += \
host1x-$(CONFIG_IOMMU_API) += \
context.o
obj-m := host1x-next.o
obj-m := host1x.o

View File

@@ -4,6 +4,8 @@
* Copyright (C) 2012-2013, NVIDIA Corporation
*/
#include <nvidia/conftest.h>
#include <linux/debugfs.h>
#include <linux/dma-mapping.h>
#include <linux/host1x-next.h>
@@ -11,7 +13,6 @@
#include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/of_device.h>
#include <linux/version.h>
#include "bus.h"
#include "dev.h"
@@ -339,7 +340,7 @@ static int host1x_device_match(struct device *dev, struct device_driver *drv)
return strcmp(dev_name(dev), drv->name) == 0;
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
#if defined(NV_BUS_TYPE_STRUCT_UEVENT_HAS_CONST_DEV_ARG) /* Linux v6.3 */
static int host1x_device_uevent(const struct device *dev,
#else
static int host1x_device_uevent(struct device *dev,

View File

@@ -496,7 +496,7 @@ resume:
host1x_hw_cdma_resume(host1x, cdma, restart_addr);
}
void cdma_update_work(struct work_struct *work)
static void cdma_update_work(struct work_struct *work)
{
struct host1x_cdma *cdma = container_of(work, struct host1x_cdma, update_work);

View File

@@ -1,12 +1,12 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2021, NVIDIA Corporation.
* Copyright (c) 2021-2024, NVIDIA Corporation.
*/
#include <linux/device.h>
#include <linux/kref.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/of_device.h>
#include <linux/pid.h>
#include <linux/slab.h>

View File

@@ -5,17 +5,18 @@
* Copyright (c) 2010-2023, NVIDIA CORPORATION & AFFILIATES. All Rights Reserved.
*/
#include <nvidia/conftest.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/dma-mapping.h>
#include <linux/io.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/of_device.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/pm_runtime.h>
#include <linux/slab.h>
#include <linux/version.h>
#include <soc/tegra/common.h>
@@ -950,7 +951,7 @@ static int host1x_probe(struct platform_device *pdev)
pm_runtime_enable(&pdev->dev);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0)
#if defined(NV_DEVM_TEGRA_CORE_DEV_INIT_OPP_TABLE_COMMON_PRESENT) /* Linux v5.17 */
err = devm_tegra_core_dev_init_opp_table_common(&pdev->dev);
if (err)
goto pm_disable;

View File

@@ -1,5 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
// Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#include <nvidia/conftest.h>
#include <linux/hwmon-sysfs.h>
#include <linux/hwmon.h>
@@ -1214,7 +1216,7 @@ destroy_lock:
return status;
}
#if KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static int f75308_remove(struct i2c_client *client)
#else
static void f75308_remove(struct i2c_client *client)
@@ -1223,7 +1225,7 @@ static void f75308_remove(struct i2c_client *client)
struct f75308_priv *priv = dev_get_drvdata(&client->dev);
mutex_destroy(&priv->locker);
#if KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0;
#endif
}
@@ -1256,10 +1258,10 @@ static struct i2c_driver f75308_driver = {
.of_match_table = of_match_ptr(f75308_match_table),
},
.detect = f75308_detect,
#if defined(NV_I2C_LEGACY_PROBE_NEW_REMOVED)
.probe = f75308_probe,
#else
#if defined(NV_I2C_DRIVER_STRUCT_HAS_PROBE_NEW) /* Dropped on Linux 6.6 */
.probe_new = f75308_probe,
#else
.probe = f75308_probe,
#endif
.remove = f75308_remove,
.address_list = f75308_addr,

View File

@@ -5,6 +5,8 @@
* Copyright (C) 2022-2023 NVIDIA CORPORATION. All rights reserved.
*/
#include <nvidia/conftest.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/init.h>
@@ -242,7 +244,7 @@ static int nvvrs11_vendor_info(struct nvvrs11_chip *chip)
return 0;
}
#if KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE
#if defined(NV_I2C_DRIVER_STRUCT_PROBE_WITHOUT_I2C_DEVICE_ID_ARG) /* Linux 6.3 */
static int nvvrs11_probe(struct i2c_client *client)
#else
static int nvvrs11_probe(struct i2c_client *client,
@@ -308,7 +310,7 @@ exit:
return ret;
}
#if KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE
#if !defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static void nvvrs11_remove(struct i2c_client *client)
{
nvvrs11_delete_sys_files(&client->dev);

View File

@@ -1,5 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# Copyright (c) 2023-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
subdir-ccflags-y += -Werror
@@ -7,6 +7,8 @@ obj-m += max9295.o
obj-m += max9296.o
ifeq ($(findstring ack_src,$(NV_BUILD_KERNEL_OPTIONS)),)
obj-m += max96712.o
ifdef CONFIG_MEDIA_SUPPORT
obj-m += ar1335_common.o
obj-m += lt6911uxc.o
obj-m += nv_imx185.o
@@ -17,7 +19,9 @@ obj-m += nv_imx390.o
obj-m += nv_imx477.o
obj-m += nv_ov5693.o
obj-m += nv_ar0234.o
obj-m += pca9570.o
obj-m += nv_hawk_owl.o
endif
obj-m += pca9570.o
obj-m += virtual_i2c_mux.o
endif

View File

@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2018-2023, NVIDIA CORPORATION & AFFILIATES. All Rights Reserved. */
/* Copyright (c) 2018-2024, NVIDIA CORPORATION & AFFILIATES. All Rights Reserved. */
/*
* ar0234_mode_tbls.h - ar0234 sensor mode tables
*/
@@ -62,7 +62,6 @@ static struct index_reg_8 ar0234_Double_Dser_Ser[] = {
{0x52, 0x0003, 0xAE}, // Disable CC to link B
{0x80, 0x0000, 0x84}, // Link A serializer address is 0x84
{0x52, 0x0003, 0xAB}, // Disable CC to link A
{0x80, 0x0000, 0x88}, // Link B serializer address is 0x88
{0x52, 0x0003, 0xAA}, // Enable CC to links A and B
@@ -70,17 +69,17 @@ static struct index_reg_8 ar0234_Double_Dser_Ser[] = {
{0x84, 0x0308, 0x7E}, // Pipe X pulls clock from port A, pipe Y from port B
{0x84, 0x0311, 0x21}, // Pipe X pulls data from port A, pipe Y from port B
{0x84, 0x0316, 0x6b}, // RAW10 to pipe Y
{0x84, 0x0314, 0x6b}, // RAW10 to pipe Y
{0x84, 0x0314, 0x6b}, // RAW10 to pipe X
{0x88, 0x0002, 0x33}, // Enable pipes X and Y
{0x88, 0x0308, 0x7E}, // Pipe X pulls clock from port A, pipe Y from port B
{0x88, 0x0311, 0x21}, // Pipe X pulls data from port A, pipe Y from port B
{0x88, 0x0316, 0x6b}, // RAW10 to pipe Y
{0x88, 0x0314, 0x6b}, // RAW10 to pipe Y
{0x52, 0x00F4, 0x0f}, // Enable pipe 0
{0x88, 0x0314, 0x6b}, // RAW10 to pipe X
{0x52, 0x00F4, 0x0f}, // Enable pipes 0-3 in deserializer
{0x52, 0x00F0, 0x10}, // Link A ID 0 to pipe 0 // Link A ID 1 to pipe 1
{0x52, 0x00F1, 0x54}, // Link B ID 0 to pipe 2 // Link B ID 1 to pipe 3
{0x52, 0x08A0, 0x01}, // CSI output is 2x4
{0x52, 0x08A0, 0x01}, // CSI output is 4x2
{0x52, 0x08A3, 0x44}, // Default 4x2 lane mapping
{0x52, 0x08A4, 0x44}, // Default 4x2 lane mapping
@@ -92,16 +91,16 @@ static struct index_reg_8 ar0234_Double_Dser_Ser[] = {
{0x52, 0x1D00, 0xF4},
{0x52, 0x1E00, 0xF4},
{0x52, 0x0415, 0x2E},
{0x52, 0x0418, 0x2E}, // 1400Mbps
{0x52, 0x041B, 0x2E},
{0x52, 0x041E, 0x2E},
{0x52, 0x0415, 0x39},
{0x52, 0x0418, 0x39}, // Date rate is 2500Mbps/lane on port D
{0x52, 0x041B, 0x39}, // Data rate is 2500Mbps/lane on port E
{0x52, 0x041E, 0x39},
{0x52, 0x1D00, 0xF5},
{0x52, 0x1E00, 0xF5},
{0x52, 0x090B, 0x07}, // Enable 3 mappings Pipe 0//video2
{0x52, 0x092D, 0x15}, // All mappings to controller 1 (port A)
{0x52, 0x092D, 0x00}, // All mappings to controller 0 (port C)
{0x52, 0x090D, 0x2B}, // Input RAW10, VC0
{0x52, 0x090E, 0x2B}, // Output RAW10, VC0
{0x52, 0x090F, 0x00}, // Input FS, VC0
@@ -110,7 +109,7 @@ static struct index_reg_8 ar0234_Double_Dser_Ser[] = {
{0x52, 0x0912, 0x01}, // Output FE, VC0
{0x52, 0x094B, 0x07}, // Enable 3 mappings Pipe 1 //video3
{0x52, 0x096D, 0x15}, // All mappings to controller 1 (port A)
{0x52, 0x096D, 0x00}, // All mappings to controller 0 (port C)
{0x52, 0x094D, 0x2B}, // Input RAW10, VC0
{0x52, 0x094E, 0x6B}, // Output RAW10, VC1
{0x52, 0x094F, 0x00}, // Input FS, VC0
@@ -119,22 +118,23 @@ static struct index_reg_8 ar0234_Double_Dser_Ser[] = {
{0x52, 0x0952, 0x41}, // Output FE, VC1
{0x52, 0x098B, 0x07}, // Enable 3 mappings Pipe 2 //video1
{0x52, 0x09AD, 0x15}, // All mappings to controller 1 (port A)
{0x52, 0x09AD, 0x15}, // All mappings to controller 1 (port D)
{0x52, 0x098D, 0x2B}, // Input RAW10, VC0
{0x52, 0x098E, 0xaB}, // Output RAW10, VC2
{0x52, 0x098E, 0x2B}, // Output RAW10, VC0
{0x52, 0x098F, 0x00}, // Input FS, VC0
{0x52, 0x0990, 0x80}, // Output FS, VC2
{0x52, 0x0990, 0x00}, // Output FS, VC0
{0x52, 0x0991, 0x01}, // Input FE, VC0
{0x52, 0x0992, 0x81}, // Output FE, VC2
{0x52, 0x0992, 0x01}, // Output FE, VC0
{0x52, 0x09CB, 0x07}, // Enable 3 mappings Pipe 3 //video0
{0x52, 0x09ED, 0x15}, // All mappings to controller 1 (port A)
{0x52, 0x09ED, 0x15}, // All mappings to controller 1 (port D)
{0x52, 0x09CD, 0x2B}, // Input RAW10, VC0
{0x52, 0x09CE, 0xeB}, // Output RAW10, VC3
{0x52, 0x09CE, 0x6B}, // Output RAW10, VC1
{0x52, 0x09CF, 0x00}, // Input FS, VC0
{0x52, 0x09D0, 0xc0}, // Output FS, VC3
{0x52, 0x09D0, 0x40}, // Output FS, VC1
{0x52, 0x09D1, 0x01}, // Input FE, VC0
{0x52, 0x09D2, 0xc1}, // Output FE, VC3
{0x52, 0x09D2, 0x41}, // Output FE, VC1
{0x52, 0x08A2, 0xF0},
{0x84, 0x02be, 0x90}, // Enable sensor power down pin.

View File

@@ -1,10 +1,12 @@
// SPDX-License-Identifier: GPL-2.0-only
// Copyright (c) 2017-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-FileCopyrightText: Copyright (c) 2017-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// Copyright (c) 2022, e-con Systems. All rights reserved.
/*
* ar1335.c - AR1335 sensor driver
* ar1335_common.c - AR1335 sensor driver
*/
#include <nvidia/conftest.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <linux/gpio.h>
@@ -50,11 +52,13 @@ static uint32_t u8arr_to_uint32(uint8_t *in_arr)
in_arr[3]);
}
static int mcu_send_ctrl_cmd(struct i2c_client *client, int cmd, uint32_t payload_len)
static int mcu_send_ctrl_cmd(struct i2c_client *client,
int cmd,
uint32_t payload_len,
uint16_t index)
{
int err;
uint8_t orig_crc = 0, calc_crc = 0;
uint16_t index = 0xFFFF;
mc_data[0] = CMD_SIGNATURE;
mc_data[1] = cmd;
@@ -409,7 +413,7 @@ static int cam_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_state *cfg,
if ((priv->mcu_cam_frmfmt[ret].size.width ==
format->format.width) &&
(priv->mcu_cam_frmfmt[ret].size.height ==
format->format.height))
format->format.height))
{
priv->frmfmt_mode = priv->mcu_cam_frmfmt[ret].mode;
flag = 1;
@@ -984,7 +988,7 @@ static int mcu_get_ctrl(struct i2c_client *client, uint32_t arg_ctrl_id,
/* First Txn Payload length = 2 */
payload_len = 2;
ret = mcu_send_ctrl_cmd(client, CMD_ID_GET_CTRL, payload_len);
ret = mcu_send_ctrl_cmd(client, CMD_ID_GET_CTRL, payload_len, index);
if (ret) {
dev_err(&client->dev, "CMD_ID_GET_CTRL send failed\n");
goto exit;
@@ -1150,7 +1154,8 @@ static int mcu_list_fmts(struct i2c_client *client,ISP_STREAM_INFO *stream_info,
/* First Txn Payload length = 0 */
payload_len = 2;
ret = mcu_send_ctrl_cmd(client, CMD_ID_GET_STREAM_INFO, payload_len);
ret = mcu_send_ctrl_cmd(client, CMD_ID_GET_STREAM_INFO,
payload_len, index);
if (ret) {
dev_err(&client->dev, "CMD_ID_GET_STREAM_INFO send failed\n");
goto exit;
@@ -1272,7 +1277,8 @@ static int mcu_get_ctrl_ui(struct i2c_client *client,
/* First Txn Payload length = 0 */
payload_len = 2;
ret = mcu_send_ctrl_cmd(client, CMD_ID_GET_CTRL_UI_INFO, payload_len);
ret = mcu_send_ctrl_cmd(client, CMD_ID_GET_CTRL_UI_INFO,
payload_len, index);
if (ret) {
dev_err(&client->dev, "CMD_ID_GET_CTRL_UI_INFO send failed\n");
goto exit;
@@ -1402,7 +1408,8 @@ static int mcu_list_ctrls(struct i2c_client *client,
/* First Txn Payload length = 0 */
payload_len = 2;
ret = mcu_send_ctrl_cmd(client, CMD_ID_GET_CTRL_INFO, payload_len);
ret = mcu_send_ctrl_cmd(client, CMD_ID_GET_CTRL_INFO,
payload_len, index);
if (ret) {
dev_err(&client->dev, "CMD_ID_GET_CTRL_INFO send failed\n");
goto exit;
@@ -2361,7 +2368,7 @@ exit:
return ret;
}
#if KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE
#if defined(NV_I2C_DRIVER_STRUCT_PROBE_WITHOUT_I2C_DEVICE_ID_ARG) /* Linux 6.3 */
static int cam_probe(struct i2c_client *client)
#else
static int cam_probe(struct i2c_client *client,
@@ -2783,7 +2790,7 @@ exit:
devm_kfree(dev, ptr); \
}
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE)
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static int cam_remove(struct i2c_client *client)
#else
static void cam_remove(struct i2c_client *client)
@@ -2797,7 +2804,7 @@ static void cam_remove(struct i2c_client *client)
if (!s_data) {
dev_err(&client->dev, "camera common data is NULL\n");
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE)
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return -EINVAL;
#else
return;
@@ -2809,7 +2816,7 @@ static void cam_remove(struct i2c_client *client)
reset_gpio = of_get_named_gpio(node, "reset-gpios", 0);
if (reset_gpio < 0) {
dev_err(&client->dev, "Unable to get reset GPIO\n");
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE)
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return -EINVAL;
#else
return;

View File

@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All Rights Reserved. */
/* Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES. All Rights Reserved. */
/*
* hawk_owl_mode_tbls.h - ar0234 sensor mode tables
*/
@@ -179,9 +179,9 @@ static struct index_reg_8 i2c_address_trans_hawk1_eeprom[] = {
};
static struct index_reg_8 i2c_address_trans_hawk2_eeprom[] = {
{0x96, 0x0042, 0x84},
{0x96, 0x0042, 0x2A},
{0x96, 0x0043, 0xA8},
{0x96, 0x0044, 0x86},
{0x96, 0x0044, 0x2C},
{0x96, 0x0045, 0xAA},
{0x00, AR0234_TABLE_END, 0x00}
};
@@ -530,6 +530,7 @@ static struct index_reg_8 ar0234_Hawk_TripleLink_Dser_Ser[] = {
{0x98, 0x0311, 0x21}, // Pipe X pulls data from port A, pipe Y from port B
{0x98, 0x0316, 0x6b}, // RAW10 to pipe Y
{0x98, 0x0314, 0x6b}, // RAW10 to pipe Y
{0x52, 0x00F4, 0x3f}, // Enable video pipe 0,1,2,3,4,5
/*Tuned params to fix streaming issues */
{0x52, 0x00F0, 0x10}, // Link A ID 0 to pipe 0 // Link A ID 1 to pipe 1

View File

@@ -4,6 +4,8 @@
* Lontium LT6911UXC HDMI-CSI bridge driver
*/
#include <nvidia/conftest.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <linux/gpio.h>
@@ -19,6 +21,134 @@
#include "../platform/tegra/camera/camera_gpio.h"
#define lt6911uxc_reg struct reg_8
#define LT6911_TABLE_WAIT_MS 0
#define LT6911_TABLE_END 1
static lt6911uxc_reg lt_enable_i2c[] = {
{0xff, 0x80},
{0xee, 0x01},
{0x10, 0x00},
{LT6911_TABLE_END, 0x00}
};
static lt6911uxc_reg lt_configure_param[] = {
{0x5e, 0xdf},
{0x58, 0x00},
{0x59, 0x50},
{0x5a, 0x10},
{LT6911_TABLE_WAIT_MS, 1},
{0x5a, 0x00},
{0x58, 0x21},
{LT6911_TABLE_END, 0x00}
};
static lt6911uxc_reg lt_block_erase[] = {
{0x5a, 0x04},
{LT6911_TABLE_WAIT_MS, 1},
{0x5a, 0x00},
{0x5b, 0x01},
{0x5c, 0x80},
{0x5d, 0x00},
{0x5a, 0x01},
{LT6911_TABLE_WAIT_MS, 1},
{0x5a, 0x00},
{LT6911_TABLE_END, 0x00}
};
static lt6911uxc_reg lt_fifo_rst[] = {
{0xff, 0x81},
{0x08, 0xbf},
{LT6911_TABLE_WAIT_MS, 1},
{0x08, 0xff},
{LT6911_TABLE_END, 0x00}
};
static lt6911uxc_reg lt_write_enable[] = {
{0xff, 0x80},
{0x5a, 0x04},
{LT6911_TABLE_WAIT_MS, 1},
{0x5a, 0x00},
{LT6911_TABLE_END, 0x00}
};
static lt6911uxc_reg lt_data_to_fifo[] = {
{0x5e, 0xdf},
{0x5a, 0x20},
{LT6911_TABLE_WAIT_MS, 1},
{0x5a, 0x00},
{LT6911_TABLE_END, 0x00}
};
static lt6911uxc_reg lt_write_disable[] = {
{0xff, 0x80},
{0x5a, 0x08},
{LT6911_TABLE_WAIT_MS, 1},
{0x5a, 0x00},
{0x58, 0x00},
{LT6911_TABLE_END, 0x00}
};
static u8 LT6911_EDIDs[][256] = {
// EDID with default 1920x1080 60fps
{
0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x3A,0xC4,0x04,0xED,0x01,0x01,0x01,0x01,
0x1E,0x21,0x01,0x03,0x80,0x6F,0x3E,0x78,0x0A,0xEE,0x91,0xA3,0x54,0x4C,0x99,0x26,
0x0F,0x50,0x54,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x02,0x3A,0x80,0x18,0x71,0x38,0x2D,0x40,0x58,0x2C,
0x45,0x00,0xBA,0x88,0x21,0x00,0x00,0x1E,0x02,0x3A,0x80,0x18,0x71,0x38,0x2D,0x40,
0x58,0x2C,0x45,0x00,0xBA,0x88,0x21,0x00,0x00,0x1E,0x00,0x00,0x00,0xFD,0x00,0x18,
0x4B,0x0F,0x87,0x22,0x00,0x0A,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0xFC,
0x00,0x44,0x75,0x61,0x6C,0x20,0x50,0x6F,0x72,0x74,0x20,0x52,0x47,0x42,0x01,0x50,
0x02,0x03,0x18,0x71,0x43,0x04,0x01,0x03,0x23,0x09,0x07,0x01,0x83,0x01,0x00,0x00,
0x67,0x03,0x0C,0x00,0x10,0x00,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xAD
},
// EDID with default 3840x2160 60fps
{
0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x3A,0xC4,0x01,0xED,0x01,0x01,0x01,0x01,
0x1E,0x21,0x01,0x03,0x80,0x6F,0x3E,0x78,0x0A,0xEE,0x91,0xA3,0x54,0x4C,0x99,0x26,
0x0F,0x50,0x54,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x08,0xE8,0x00,0x30,0xF2,0x70,0x5A,0x80,0xB0,0x58,
0x8A,0x00,0x50,0x1D,0x74,0x00,0x00,0x1E,0x08,0xE8,0x00,0x30,0xF2,0x70,0x5A,0x80,
0xB0,0x58,0x8A,0x00,0x50,0x1D,0x74,0x00,0x00,0x1E,0x00,0x00,0x00,0xFD,0x00,0x18,
0x4B,0x0F,0x87,0x3C,0x00,0x0A,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0xFC,
0x00,0x44,0x75,0x61,0x6C,0x20,0x50,0x6F,0x72,0x74,0x20,0x52,0x47,0x42,0x01,0xC7,
0x02,0x03,0x20,0x71,0x43,0x61,0x01,0x03,0x23,0x09,0x07,0x01,0x83,0x01,0x00,0x00,
0x67,0x03,0x0C,0x00,0x10,0x00,0x00,0x3C,0x67,0xD8,0x5D,0xC4,0x01,0x78,0x80,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xEF
},
// EDID with default 1280x720 60fps
{
0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x3A,0xC4,0x05,0xED,0x01,0x01,0x01,0x01,
0x1E,0x21,0x01,0x03,0x80,0x6F,0x3E,0x78,0x0A,0xEE,0x91,0xA3,0x54,0x4C,0x99,0x26,
0x0F,0x50,0x54,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x1D,0x00,0x72,0x51,0xD0,0x1E,0x20,0x6E,0x28,
0x55,0x00,0xC4,0x8E,0x21,0x00,0x00,0x1E,0x01,0x1D,0x00,0x72,0x51,0xD0,0x1E,0x20,
0x6E,0x28,0x55,0x00,0xC4,0x8E,0x21,0x00,0x00,0x1E,0x00,0x00,0x00,0xFD,0x00,0x18,
0x4B,0x0F,0x87,0x22,0x00,0x0A,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x00,0x00,0xFC,
0x00,0x44,0x75,0x61,0x6C,0x20,0x50,0x6F,0x72,0x74,0x20,0x52,0x47,0x42,0x01,0xE1,
0x02,0x03,0x18,0x71,0x43,0x04,0x01,0x03,0x23,0x09,0x07,0x01,0x83,0x01,0x00,0x00,
0x67,0x03,0x0C,0x00,0x10,0x00,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xAD
}
};
static const struct of_device_id lt6911uxc_of_match[] = {
{ .compatible = "nvidia,lt6911uxc", },
{ },
@@ -37,13 +167,18 @@ static const int lt6911uxc_30fps[] = {
30,
};
static const u8 lt6911uxc_HDMI_Signal = 0xa3;
static const u8 lt6911uxc_FW_version[] = { 0xa7, 0xa8, 0xa9, 0xaa };
struct lt6911uxc {
struct i2c_client *i2c_client;
struct v4l2_subdev *subdev;
u16 fine_integ_time;
u32 frame_length;
u16 fine_integ_time;
u32 frame_length;
struct camera_common_data *s_data;
struct tegracam_device *tc_dev;
struct regmap *regmap;
};
static const struct camera_common_frmfmt lt6911uxc_frmfmt[] = {
@@ -53,11 +188,50 @@ static const struct camera_common_frmfmt lt6911uxc_frmfmt[] = {
};
static const struct regmap_config sensor_regmap_config = {
.reg_bits = 16,
.reg_bits = 8,
.val_bits = 8,
.cache_type = REGCACHE_RBTREE,
};
static inline int lt6911uxc_read_reg(struct camera_common_data *s_data,
u16 addr, u8 *val)
{
int err = 0;
u32 reg_val = 0;
err = regmap_read(s_data->regmap, addr, &reg_val);
if (err) {
dev_err(s_data->dev, "%s: i2c read , 0x%x = %x",
__func__, addr, reg_val);
return err;
}
*val = reg_val & 0xff;
return err;
}
static inline int lt6911uxc_write_reg(struct camera_common_data *s_data,
u16 addr, u8 val)
{
int err = 0;
err = regmap_write(s_data->regmap, addr, val);
if (err)
dev_err(s_data->dev, "%s: i2c write failed, 0x%x = %x",
__func__, addr, val);
return err;
}
static int lt6911uxc_write_table(struct lt6911uxc *priv,
const lt6911uxc_reg table[])
{
return regmap_util_write_table_8(priv->s_data->regmap,
table,
NULL, 0,
LT6911_TABLE_WAIT_MS,
LT6911_TABLE_END);
}
static int lt6911uxc_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
@@ -84,6 +258,8 @@ static int lt6911uxc_start_streaming(struct tegracam_device *tc_dev)
else
gpio_set_value(pw->reset_gpio, 1);
}
msleep(300);
return 0;
}
@@ -101,29 +277,7 @@ static int lt6911uxc_stop_streaming(struct tegracam_device *tc_dev)
return 0;
}
static int lt6911uxc_set_mode(struct tegracam_device *tc_dev)
{
/* Width and Height taken care of by the firmware */
return 0;
}
static inline int lt6911uxc_read_reg(struct camera_common_data *s_data,
u16 addr, u8 *val)
{
int err = 0;
u32 reg_val = 0;
err = regmap_read(s_data->regmap, addr, &reg_val);
*val = reg_val & 0xff;
return err;
}
static inline int lt6911uxc_write_reg(struct camera_common_data *s_data,
u16 addr, u8 val)
{
return 0;
}
static int lt6911uxc_power_get(struct tegracam_device *tc_dev)
{
@@ -309,9 +463,9 @@ static int lt6911uxc_power_on(struct camera_common_data *s_data)
if (pw->reset_gpio) {
if (gpiod_cansleep(gpio_to_desc(pw->reset_gpio)))
gpio_set_value_cansleep(pw->reset_gpio, 0);
gpio_set_value_cansleep(pw->reset_gpio, 1);
else
gpio_set_value(pw->reset_gpio, 0);
gpio_set_value(pw->reset_gpio, 1);
}
usleep_range(10, 20);
@@ -335,7 +489,7 @@ static int lt6911uxc_power_on(struct camera_common_data *s_data)
goto lt6911uxc_dvdd_fail;
}
usleep_range(10, 20);
msleep(300);
pw->state = SWITCH_ON;
@@ -389,11 +543,64 @@ static int lt6911uxc_power_off(struct camera_common_data *s_data)
return 0;
}
static int lt6911uxc_set_mode(struct tegracam_device *tc_dev)
{
int err = 0;
int i, j;
struct camera_common_data *s_data = tc_dev->s_data;
struct lt6911uxc *priv = (struct lt6911uxc *)s_data->priv;
struct camera_common_power_rail *pw = s_data->power;
// Write the corresponding Shadow EDID
err |= lt6911uxc_write_table(priv, lt_enable_i2c);
err |= lt6911uxc_write_table(priv, lt_configure_param);
err |= lt6911uxc_write_table(priv, lt_block_erase);
msleep(600);
for (i = 0; i < 8; i++)
{
err |= lt6911uxc_write_table(priv, lt_fifo_rst);
err |= lt6911uxc_write_table(priv, lt_write_enable);
err |= lt6911uxc_write_table(priv, lt_data_to_fifo);
for(j = 0; j < 32; j++)
{
lt6911uxc_write_reg(priv->s_data, 0x59,
LT6911_EDIDs[s_data->mode][(i * 32) + j]);
}
err |= lt6911uxc_write_reg(priv->s_data, 0x5b, 0x01);
err |= lt6911uxc_write_reg(priv->s_data, 0x5c, 0x80);
err |= lt6911uxc_write_reg(priv->s_data, 0x5d, (i) * 32);
err |= lt6911uxc_write_reg(priv->s_data, 0x5a, 0x10);
msleep(1);
err |= lt6911uxc_write_reg(priv->s_data, 0x5a, 0x00);
msleep(1);
}
err |= lt6911uxc_write_table(priv, lt_write_disable);
if (err)
dev_err(tc_dev->dev, "%s Error in writing shadow EDID \n", __func__);
// Toggle the reset pin to low, stream on will again set it to high
if (pw->reset_gpio) {
if (gpiod_cansleep(gpio_to_desc(pw->reset_gpio)))
gpio_set_value_cansleep(pw->reset_gpio, 0);
else
gpio_set_value(pw->reset_gpio, 0);
}
// Keep reset pin low for the changes to take effect
msleep(800);
return err;
}
static int lt6911uxc_board_setup(struct lt6911uxc *priv)
{
struct camera_common_data *s_data = priv->s_data;
struct camera_common_pdata *pdata = s_data->pdata;
struct device *dev = s_data->dev;
u8 version;
int i = 0, fw_ver;
int err = 0;
if (pdata->mclk_name) {
@@ -409,11 +616,31 @@ static int lt6911uxc_board_setup(struct lt6911uxc *priv)
dev_err(dev, "error during power on sensor (%d)\n", err);
goto err_power_on;
}
msleep(300);
err |= lt6911uxc_write_table(priv, lt_enable_i2c);
err |= lt6911uxc_write_reg(s_data, 0xff, 0x86);
for (i = 0; i < sizeof(lt6911uxc_FW_version); i++) {
fw_ver = 0;
err = lt6911uxc_read_reg(s_data, lt6911uxc_FW_version[i], &version);
if (err)
dev_err(s_data->dev, "%s: Error in reading FW version \n",
__func__);
fw_ver = (fw_ver << 1) | version;
}
dev_info(s_data->dev, "Lontium FW version %d \n",fw_ver);
err_power_on:
if (pdata->mclk_name)
camera_common_mclk_disable(s_data);
err = lt6911uxc_power_off(s_data);
if (err) {
dev_err(dev, "error during power off sensor (%d)\n", err);
goto err_power_on;
}
done:
return err;
}
@@ -442,7 +669,7 @@ static struct camera_common_sensor_ops lt6911uxc_common_ops = {
};
#if KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE
#if defined(NV_I2C_DRIVER_STRUCT_PROBE_WITHOUT_I2C_DEVICE_ID_ARG) /* Linux 6.3 */
static int lt6911uxc_probe(struct i2c_client *client)
#else
static int lt6911uxc_probe(struct i2c_client *client,
@@ -506,7 +733,7 @@ static int lt6911uxc_probe(struct i2c_client *client,
return 0;
}
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE)
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static int lt6911uxc_remove(struct i2c_client *client)
#else
static void lt6911uxc_remove(struct i2c_client *client)
@@ -516,7 +743,7 @@ static void lt6911uxc_remove(struct i2c_client *client)
struct lt6911uxc *priv;
if (!s_data)
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE)
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return -EINVAL;
#else
return;
@@ -526,7 +753,7 @@ static void lt6911uxc_remove(struct i2c_client *client)
tegracam_v4l2subdev_unregister(priv->tc_dev);
tegracam_device_unregister(priv->tc_dev);
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE)
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0;
#endif
}

View File

@@ -4,6 +4,8 @@
* max9295.c - max9295 GMSL Serializer driver
*/
#include <nvidia/conftest.h>
#include <media/camera_common.h>
#include <linux/module.h>
#include <media/max9295.h>
@@ -463,7 +465,7 @@ static struct regmap_config max9295_regmap_config = {
.cache_type = REGCACHE_RBTREE,
};
#if KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE
#if defined(NV_I2C_DRIVER_STRUCT_PROBE_WITHOUT_I2C_DEVICE_ID_ARG) /* Linux 6.3 */
static int max9295_probe(struct i2c_client *client)
#else
static int max9295_probe(struct i2c_client *client,
@@ -512,7 +514,7 @@ static int max9295_probe(struct i2c_client *client,
return err;
}
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE)
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static int max9295_remove(struct i2c_client *client)
#else
static void max9295_remove(struct i2c_client *client)
@@ -526,7 +528,7 @@ static void max9295_remove(struct i2c_client *client)
i2c_unregister_device(client);
client = NULL;
}
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE)
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0;
#endif
}

View File

@@ -4,6 +4,8 @@
* max9296.c - max9296 GMSL Deserializer driver
*/
#include <nvidia/conftest.h>
#include <linux/gpio.h>
#include <linux/module.h>
#include <linux/of.h>
@@ -846,7 +848,7 @@ static struct regmap_config max9296_regmap_config = {
.cache_type = REGCACHE_RBTREE,
};
#if KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE
#if defined(NV_I2C_DRIVER_STRUCT_PROBE_WITHOUT_I2C_DEVICE_ID_ARG) /* Linux 6.3 */
static int max9296_probe(struct i2c_client *client)
#else
static int max9296_probe(struct i2c_client *client,
@@ -892,7 +894,7 @@ static int max9296_probe(struct i2c_client *client,
return 0;
}
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE)
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static int max9296_remove(struct i2c_client *client)
#else
static void max9296_remove(struct i2c_client *client)
@@ -906,7 +908,7 @@ static void max9296_remove(struct i2c_client *client)
i2c_unregister_device(client);
client = NULL;
}
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE)
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0;
#endif
}

View File

@@ -7,6 +7,8 @@
/* #define DEBUG */
#include <nvidia/conftest.h>
#include <linux/seq_file.h>
#include <linux/debugfs.h>
#include <media/camera_common.h>
@@ -226,7 +228,7 @@ static struct regmap_config max96712_regmap_config = {
.cache_type = REGCACHE_RBTREE,
};
#if KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE
#if defined(NV_I2C_DRIVER_STRUCT_PROBE_WITHOUT_I2C_DEVICE_ID_ARG) /* Linux 6.3 */
static int max96712_probe(struct i2c_client *client)
#else
static int max96712_probe(struct i2c_client *client,
@@ -266,7 +268,7 @@ static int max96712_probe(struct i2c_client *client,
return err;
}
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE)
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static int max96712_remove(struct i2c_client *client)
#else
static void max96712_remove(struct i2c_client *client)
@@ -277,7 +279,7 @@ static void max96712_remove(struct i2c_client *client)
i2c_unregister_device(client);
client = NULL;
}
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE)
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0;
#endif
}

View File

@@ -1,9 +1,11 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2018-2023, NVIDIA CORPORATION & AFFILIATES. All Rights Reserved.
// SPDX-License-Identifier: GPL-2.0-only
// SPDX-FileCopyrightText: Copyright (c) 2018-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
/*
* ar0234.c - ar0234 sensor driver
*/
#include <nvidia/conftest.h>
#define DEBUG 1
#include <linux/slab.h>
#include <linux/uaccess.h>
@@ -26,6 +28,7 @@
#define MAX_TANGENTIAL_COEFFICIENTS 2
#define MAX_FISHEYE_COEFFICIENTS 6
#define CAMERA_MAX_SN_LENGTH 32
#define LEOP_CAMERA_MAX_SN_LENGTH 10
#define MAX_RLS_COLOR_CHANNELS 4
#define MAX_RLS_BREAKPOINTS 6
@@ -62,7 +65,6 @@ static const u32 ctrl_cid_list[] = {
TEGRA_CAMERA_CID_ALTERNATING_EXPOSURE,
};
const u16 alternating_exposure_cfg_size = sizeof(struct alternating_exposure_cfg);
// Coefficients as per distortion model (wide FOV) being used
struct fisheye_lens_distortion_coeff {
@@ -125,7 +127,13 @@ struct camera_extrinsics {
float tx, ty, tz;
};
struct imu_params {
/*
* IMU parameters used by HAWK 1.0. HAWK 1.0 did not have IMU noise model parameters
* in EEPROM. To preserve backward compatibility with HAWK 1.0, the EEPROM data is arranged
* in a certain way which requires tracking the imu noise model parameters in a
* separate structure.
*/
struct imu_params_v1 {
// 3D vector to add to accelerometer readings
float linear_acceleration_bias[3];
// 3D vector to add to gyroscope readings
@@ -134,7 +142,12 @@ struct imu_params {
float gravity_acceleration[3];
// Extrinsic structure for IMU device
struct camera_extrinsics extr;
// Noise model parameters
};
struct imu_params_noise_m {
/*
* Noise model parameters
*/
float update_rate;
float linear_acceleration_noise_density;
float linear_acceleration_random_walk;
@@ -142,6 +155,14 @@ struct imu_params {
float angular_velocity_random_walk;
};
/*
* Combined IMU calibration data structure
*/
struct imu_params_v2 {
struct imu_params_v1 imu_data_v1;
struct imu_params_noise_m nm;
};
struct radial_lsc_params {
// Image height
u16 image_height;
@@ -184,7 +205,7 @@ struct NvCamSyncSensorCalibData {
u8 imu_present;
// Intrinsic structure for IMU
struct imu_params imu;
struct imu_params_v2 imu;
// HAWK module serial number
u8 serial_number[CAMERA_MAX_SN_LENGTH];
@@ -219,10 +240,14 @@ struct LiEeprom_Content_Struct {
/**
* Intrinsic structure for IMU
*/
struct imu_params imu;
struct imu_params_v1 imu;
u8 tmp[16];
// HAWK module serial number
u8 serial_number[CAMERA_MAX_SN_LENGTH];
u8 serial_number[LEOP_CAMERA_MAX_SN_LENGTH];
struct imu_params_noise_m nm;
// Radial Lens Shading Correction parameters
struct radial_lsc_params left_rls;
@@ -676,9 +701,10 @@ static int ar0234_fill_eeprom(struct tegracam_device *tc_dev,
priv->EepromCalib.cam_extr = tmp->cam_extr;
priv->EepromCalib.imu_present = tmp->imu_present;
priv->EepromCalib.imu = tmp->imu;
priv->EepromCalib.imu.imu_data_v1 = tmp->imu;
priv->EepromCalib.imu.nm = tmp->nm;
memcpy(priv->EepromCalib.serial_number, tmp->serial_number,
CAMERA_MAX_SN_LENGTH);
8);
if (priv->sync_sensor_index == 1)
priv->EepromCalib.rls = tmp->left_rls;
@@ -792,7 +818,7 @@ static struct tegracam_ctrl_ops ar0234_ctrl_ops = {
.numctrls = ARRAY_SIZE(ctrl_cid_list),
.ctrl_cid_list = ctrl_cid_list,
.string_ctrl_size = {AR0234_EEPROM_STR_SIZE},
.compound_ctrl_size = {sizeof(struct NvCamSyncSensorCalibData), alternating_exposure_cfg_size},
.compound_ctrl_size = {sizeof(struct NvCamSyncSensorCalibData), sizeof(struct alternating_exposure_cfg)},
.set_gain = ar0234_set_gain,
.set_exposure = ar0234_set_exposure,
.set_exposure_short = ar0234_set_exposure,
@@ -1044,7 +1070,7 @@ static int ar0234_board_setup(struct ar0234 *priv)
#if KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE
#if defined(NV_I2C_DRIVER_STRUCT_PROBE_WITHOUT_I2C_DEVICE_ID_ARG) /* Linux 6.3 */
static int ar0234_probe(struct i2c_client *client)
#else
static int ar0234_probe(struct i2c_client *client,
@@ -1149,7 +1175,7 @@ static int ar0234_probe(struct i2c_client *client,
return 0;
}
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE)
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static int ar0234_remove(struct i2c_client *client)
#else
static void ar0234_remove(struct i2c_client *client)
@@ -1159,7 +1185,7 @@ static void ar0234_remove(struct i2c_client *client)
struct ar0234 *priv;
if (!s_data)
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE)
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return -EINVAL;
#else
return;
@@ -1169,7 +1195,7 @@ static void ar0234_remove(struct i2c_client *client)
tegracam_v4l2subdev_unregister(priv->tc_dev);
tegracam_device_unregister(priv->tc_dev);
ar0234_eeprom_device_release(priv);
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE)
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0;
#endif
}

View File

@@ -1,9 +1,11 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All Rights Reserved.
// SPDX-License-Identifier: GPL-2.0-only
// SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
/*
* nv_hawk_owl.c.c - ar0234 sensor driver
*/
#include <nvidia/conftest.h>
#define DEBUG 0
#include <linux/slab.h>
#include <linux/uaccess.h>
@@ -15,6 +17,7 @@
#include <linux/of_gpio.h>
#include <media/max9295.h>
#include <media/max9296.h>
#include <media/nv_hawk_owl.h>
#include <media/tegracam_core.h>
#include "hawk_owl_mode_tbls.h"
#include <linux/ktime.h>
@@ -23,6 +26,7 @@
#define MAX_TANGENTIAL_COEFFICIENTS 2
#define MAX_FISHEYE_COEFFICIENTS 6
#define CAMERA_MAX_SN_LENGTH 32
#define LEOP_CAMERA_MAX_SN_LENGTH 10
#define MAX_RLS_COLOR_CHANNELS 4
#define MAX_RLS_BREAKPOINTS 6
#define OWL_CHANNEL 1
@@ -64,8 +68,6 @@ static const u32 ctrl_cid_list[] = {
TEGRA_CAMERA_CID_ALTERNATING_EXPOSURE,
};
const u16 alternating_exposure_cfg_size = sizeof(struct alternating_exposure_cfg);
// Coefficients as per distortion model (wide FOV) being used
typedef struct
{
@@ -127,6 +129,13 @@ typedef struct
// Translation parameter from one camera to another parameter
float tx, ty, tz;
} camera_extrinsics;
/*
* IMU parameters used by HAWK 1.0. HAWK 1.0 did not have IMU noise model parameters
* in EEPROM. To preserve backward compatibility with HAWK 1.0, the EEPROM data is arranged
* in a certain way which requires tracking the imu noise model parameters in a
* separate structure.
*/
typedef struct
{
// 3D vector to add to accelerometer readings
@@ -137,13 +146,26 @@ typedef struct
float gravity_acceleration[3];
// Extrinsic structure for IMU device
camera_extrinsics extr;
// Noise model parameters
} imu_params_v1;
typedef struct {
/*
* Noise model parameters
*/
float update_rate;
float linear_acceleration_noise_density;
float linear_acceleration_random_walk;
float angular_velocity_noise_density;
float angular_velocity_random_walk;
} imu_params;
} imu_params_noise_m;
/*
* Combined IMU calibration data structure
*/
typedef struct {
imu_params_v1 imu_data_v1;
imu_params_noise_m nm;
} imu_params_v2;
typedef struct {
// Image height
@@ -187,7 +209,7 @@ typedef struct
u8 imu_present;
// Intrinsic structure for IMU
imu_params imu;
imu_params_v2 imu;
// HAWK module serial number
u8 serial_number[CAMERA_MAX_SN_LENGTH];
@@ -195,6 +217,7 @@ typedef struct
// Radial Lens Shading Correction parameters
radial_lsc_params rls;
} NvCamSyncSensorCalibData;
typedef struct
{
/**
@@ -222,15 +245,20 @@ typedef struct
/**
* Intrinsic structure for IMU
*/
imu_params imu;
imu_params_v1 imu;
u8 tmp[16];
// HAWK module serial number
u8 serial_number[CAMERA_MAX_SN_LENGTH];
u8 serial_number[LEOP_CAMERA_MAX_SN_LENGTH];
imu_params_noise_m nm;
// Radial Lens Shading Correction parameters
radial_lsc_params left_rls;
radial_lsc_params right_rls;
} LiEeprom_Content_Struct;
struct ar0234 {
struct camera_common_eeprom_data eeprom[AR0234_EEPROM_NUM_BLOCKS];
u8 eeprom_buf[AR0234_EEPROM_SIZE];
@@ -245,17 +273,20 @@ struct ar0234 {
const char *sensor_name;
NvCamSyncSensorCalibData EepromCalib;
};
static const struct regmap_config sensor_regmap_config = {
.reg_bits = 16,
.val_bits = 16,
.cache_type = REGCACHE_RBTREE,
};
static inline void ar0234_get_coarse_time_regs_shs1(ar0234_reg *regs,
u16 coarse_time)
{
regs->addr = AR0234_COARSE_TIME_SHS1_ADDR;
regs->val = (coarse_time) & 0xffff;
}
static inline void ar0234_get_gain_reg(ar0234_reg *regs,
u16 gain)
{
@@ -343,7 +374,7 @@ retry_sensor:
return -1;
} else {
if (0x301a == table[i].addr || 0x3060 == table[i].addr)
msleep(100);
msleep(20);
}
} else {
retry = 5;
@@ -554,7 +585,7 @@ static int ar0234_power_on(struct camera_common_data *s_data)
struct camera_common_power_rail *pw = s_data->power;
struct camera_common_pdata *pdata = s_data->pdata;
struct device *dev = s_data->dev;
struct ar0234 *priv = (struct ar0234 *) s_data->priv;
if (pdata && pdata->power_on) {
err = pdata->power_on(pw);
if (err)
@@ -567,8 +598,6 @@ static int ar0234_power_on(struct camera_common_data *s_data)
gpio_set_value(pw->reset_gpio, 1);
usleep_range(1000, 2000);
pw->state = SWITCH_ON;
/*i2c address trans for Hawk & Owl*/
err = ar0234_hawk_owl_i2ctrans(priv);
return err;
}
static int ar0234_power_off(struct camera_common_data *s_data)
@@ -763,9 +792,10 @@ static int ar0234_fill_eeprom(struct tegracam_device *tc_dev,
}
priv->EepromCalib.cam_extr = tmp->cam_extr;
priv->EepromCalib.imu_present = tmp->imu_present;
priv->EepromCalib.imu = tmp->imu;
priv->EepromCalib.imu.imu_data_v1 = tmp->imu;
priv->EepromCalib.imu.nm = tmp->nm;
memcpy(priv->EepromCalib.serial_number, tmp->serial_number,
CAMERA_MAX_SN_LENGTH);
8);
if (priv->sync_sensor_index == 1)
priv->EepromCalib.rls = tmp->left_rls;
@@ -877,7 +907,7 @@ static struct tegracam_ctrl_ops ar0234_ctrl_ops = {
.numctrls = ARRAY_SIZE(ctrl_cid_list),
.ctrl_cid_list = ctrl_cid_list,
.string_ctrl_size = {AR0234_EEPROM_STR_SIZE},
.compound_ctrl_size = {sizeof(NvCamSyncSensorCalibData), alternating_exposure_cfg_size},
.compound_ctrl_size = {sizeof(NvCamSyncSensorCalibData), sizeof(struct alternating_exposure_cfg)},
.set_gain = ar0234_set_gain,
.set_exposure = ar0234_set_exposure,
.set_exposure_short = ar0234_set_exposure,
@@ -1434,7 +1464,7 @@ static int ar0234_hawk_owl_deser_ser_program(struct ar0234 *priv)
return err;
}
#if KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE
#if defined(NV_I2C_DRIVER_STRUCT_PROBE_WITHOUT_I2C_DEVICE_ID_ARG) /* Linux 6.3 */
static int ar0234_probe(struct i2c_client *client)
#else
static int ar0234_probe(struct i2c_client *client,
@@ -1503,6 +1533,14 @@ static int ar0234_probe(struct i2c_client *client,
dev_err(&client->dev,"Failed to enable gpio/ to do serializer i2c address trans\n");
goto un_register;
}
/* i2c address trans for Hawk & Owl */
err = ar0234_hawk_owl_i2ctrans(priv);
if (err) {
dev_err(&client->dev, "Failed to do i2c address trans\n");
goto un_register;
}
err = ar0234_power_on(tc_dev->s_data);
if (err) {
dev_err(&client->dev,"Failed to power on\n");
@@ -1572,7 +1610,7 @@ un_register:
return err;
}
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE)
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static int ar0234_remove(struct i2c_client *client)
#else
static void ar0234_remove(struct i2c_client *client)
@@ -1582,7 +1620,7 @@ static void ar0234_remove(struct i2c_client *client)
struct ar0234 *priv = (struct ar0234 *)s_data->priv;
if (!s_data)
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE)
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return -EINVAL;
#else
return;
@@ -1590,7 +1628,7 @@ static void ar0234_remove(struct i2c_client *client)
tegracam_v4l2subdev_unregister(priv->tc_dev);
tegracam_device_unregister(priv->tc_dev);
ar0234_eeprom_device_release(priv);
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE)
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0;
#endif
}

View File

@@ -5,6 +5,8 @@
* Copyright (c) 2016-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*/
#include <nvidia/conftest.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <linux/gpio.h>
@@ -775,7 +777,7 @@ static const struct v4l2_subdev_internal_ops imx185_subdev_internal_ops = {
.open = imx185_open,
};
#if KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE
#if defined(NV_I2C_DRIVER_STRUCT_PROBE_WITHOUT_I2C_DEVICE_ID_ARG) /* Linux 6.3 */
static int imx185_probe(struct i2c_client *client)
#else
static int imx185_probe(struct i2c_client *client,
@@ -838,11 +840,11 @@ static int imx185_probe(struct i2c_client *client,
return 0;
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
static void
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static int
imx185_remove(struct i2c_client *client)
#else
static int
static void
imx185_remove(struct i2c_client *client)
#endif
{
@@ -850,17 +852,17 @@ imx185_remove(struct i2c_client *client)
struct imx185 *priv;
if (!s_data)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
return;
#else
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return -EINVAL;
#else
return;
#endif
priv = (struct imx185 *)s_data->priv;
tegracam_v4l2subdev_unregister(priv->tc_dev);
tegracam_device_unregister(priv->tc_dev);
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0;
#endif
}

View File

@@ -6,6 +6,8 @@
*
*/
#include <nvidia/conftest.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <linux/gpio.h>
@@ -691,7 +693,7 @@ static const struct v4l2_subdev_internal_ops imx219_subdev_internal_ops = {
.open = imx219_open,
};
#if KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE
#if defined(NV_I2C_DRIVER_STRUCT_PROBE_WITHOUT_I2C_DEVICE_ID_ARG) /* Linux 6.3 */
static int imx219_probe(struct i2c_client *client)
#else
static int imx219_probe(struct i2c_client *client,
@@ -754,10 +756,10 @@ static int imx219_probe(struct i2c_client *client,
return 0;
}
#if KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE
static void imx219_remove(struct i2c_client *client)
#else
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static int imx219_remove(struct i2c_client *client)
#else
static void imx219_remove(struct i2c_client *client)
#endif
{
struct camera_common_data *s_data = to_camera_common_data(&client->dev);
@@ -765,7 +767,7 @@ static int imx219_remove(struct i2c_client *client)
if (!s_data) {
dev_err(&client->dev, "camera common data is NULL\n");
#if KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return -EINVAL;
#else
return;
@@ -776,7 +778,7 @@ static int imx219_remove(struct i2c_client *client)
tegracam_v4l2subdev_unregister(priv->tc_dev);
tegracam_device_unregister(priv->tc_dev);
#if KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0;
#endif
}

View File

@@ -5,6 +5,8 @@
* Copyright (c) 2015-2023, NVIDIA CORPORATION. All rights reserved.
*/
#include <nvidia/conftest.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <linux/gpio.h>
@@ -1260,7 +1262,7 @@ static const struct v4l2_subdev_internal_ops imx274_subdev_internal_ops = {
.open = imx274_open,
};
#if KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE
#if defined(NV_I2C_DRIVER_STRUCT_PROBE_WITHOUT_I2C_DEVICE_ID_ARG) /* Linux 6.3 */
static int imx274_probe(struct i2c_client *client)
#else
static int imx274_probe(struct i2c_client *client,
@@ -1333,20 +1335,20 @@ static int imx274_probe(struct i2c_client *client,
return 0;
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
static void imx274_remove(struct i2c_client *client)
#else
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static int imx274_remove(struct i2c_client *client)
#else
static void imx274_remove(struct i2c_client *client)
#endif
{
struct camera_common_data *s_data = to_camera_common_data(&client->dev);
struct imx274 *priv;
if (!s_data)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
return;
#else
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return -EINVAL;
#else
return;
#endif
priv = (struct imx274 *)s_data->priv;
@@ -1358,7 +1360,7 @@ static int imx274_remove(struct i2c_client *client)
imx274_eeprom_device_release(priv);
mutex_destroy(&priv->streaming_lock);
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0;
#endif
}

View File

@@ -1,5 +1,11 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2017-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-FileCopyrightText: Copyright (c) 2017-2024 NVIDIA CORPORATION & AFFILIATES.
// All rights reserved.
//
// nv_imx318.c - imx318 sensor driver
//
#include <nvidia/conftest.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
@@ -129,6 +135,11 @@ static int imx318_set_frame_rate_ex(struct tegracam_device *tc_dev,
u8 fl_arr[2];
int err = 0;
if (val < mode->control_properties.min_framerate)
val = mode->control_properties.min_framerate;
else if (val > mode->control_properties.max_framerate)
val = mode->control_properties.max_framerate;
if (mode->image_properties.line_length == 0 ||
val == 0) {
return -EINVAL;
@@ -695,7 +706,7 @@ static const struct v4l2_subdev_internal_ops imx318_subdev_internal_ops = {
.open = imx318_open,
};
#if KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE
#if defined(NV_I2C_DRIVER_STRUCT_PROBE_WITHOUT_I2C_DEVICE_ID_ARG) /* Linux 6.3 */
static int imx318_probe(struct i2c_client *client)
#else
static int imx318_probe(struct i2c_client *client,
@@ -759,7 +770,7 @@ static int imx318_probe(struct i2c_client *client,
return 0;
}
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE)
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static int imx318_remove(struct i2c_client *client)
#else
static void imx318_remove(struct i2c_client *client)
@@ -769,7 +780,7 @@ static void imx318_remove(struct i2c_client *client)
struct imx318 *priv;
if (!s_data)
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE)
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return -EINVAL;
#else
return;
@@ -780,7 +791,7 @@ static void imx318_remove(struct i2c_client *client)
tegracam_device_unregister(priv->tc_dev);
imx318_eeprom_device_release(priv);
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE)
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0;
#endif
}

View File

@@ -1,6 +1,8 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2018-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#include <nvidia/conftest.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <linux/gpio.h>
@@ -752,7 +754,7 @@ error:
return err;
}
#if KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE
#if defined(NV_I2C_DRIVER_STRUCT_PROBE_WITHOUT_I2C_DEVICE_ID_ARG) /* Linux 6.3 */
static int imx390_probe(struct i2c_client *client)
#else
static int imx390_probe(struct i2c_client *client,
@@ -854,7 +856,7 @@ static int imx390_probe(struct i2c_client *client,
return 0;
}
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE)
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static int imx390_remove(struct i2c_client *client)
#else
static void imx390_remove(struct i2c_client *client)
@@ -864,7 +866,7 @@ static void imx390_remove(struct i2c_client *client)
struct imx390 *priv;
if (!s_data)
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE)
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return -EINVAL;
#else
return;
@@ -878,7 +880,7 @@ static void imx390_remove(struct i2c_client *client)
tegracam_v4l2subdev_unregister(priv->tc_dev);
tegracam_device_unregister(priv->tc_dev);
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE)
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0;
#endif
}

View File

@@ -1,13 +1,15 @@
// SPDX-License-Identifier: GPL-2.0-only
// SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
/*
* Copyright (c) 2020, RidgeRun. All rights reserved.
* Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*
* Contact us: support@ridgerun.com
*
* nv_imx477.c - imx477 sensor driver
*/
#include <nvidia/conftest.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <linux/gpio.h>
@@ -24,6 +26,8 @@
#include "../platform/tegra/camera/camera_gpio.h"
#include "imx477_mode_tbls.h"
#define IMX477_SENSOR_INTERNAL_CLK_FREQ 840000000
static const struct of_device_id imx477_of_match[] = {
{.compatible = "ridgerun,imx477",},
{},
@@ -226,7 +230,7 @@ static int imx477_set_frame_rate(struct tegracam_device *tc_dev, s64 val)
if (val == 0 || mode->image_properties.line_length == 0)
return -EINVAL;
frame_length = (u32) (mode->signal_properties.pixel_clock.val *
frame_length = (u32) (IMX477_SENSOR_INTERNAL_CLK_FREQ *
(u64) mode->control_properties.framerate_factor /
mode->image_properties.line_length / val);
@@ -277,12 +281,12 @@ static int imx477_set_exposure(struct tegracam_device *tc_dev, s64 val)
fine_integ_time_factor = priv->fine_integ_time *
mode->control_properties.exposure_factor /
mode->signal_properties.pixel_clock.val;
IMX477_SENSOR_INTERNAL_CLK_FREQ;
dev_dbg(dev, "%s: Setting exposure control to: %lld\n", __func__, val);
coarse_time = (val - fine_integ_time_factor)
* mode->signal_properties.pixel_clock.val
* IMX477_SENSOR_INTERNAL_CLK_FREQ
/ mode->control_properties.exposure_factor
/ mode->image_properties.line_length;
@@ -720,7 +724,7 @@ static const struct v4l2_subdev_internal_ops imx477_subdev_internal_ops = {
.open = imx477_open,
};
#if KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE
#if defined(NV_I2C_DRIVER_STRUCT_PROBE_WITHOUT_I2C_DEVICE_ID_ARG) /* Linux 6.3 */
static int imx477_probe(struct i2c_client *client)
#else
static int imx477_probe(struct i2c_client *client,
@@ -780,10 +784,10 @@ static int imx477_probe(struct i2c_client *client,
return 0;
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
static void imx477_remove(struct i2c_client *client)
#else
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static int imx477_remove(struct i2c_client *client)
#else
static void imx477_remove(struct i2c_client *client)
#endif
{
struct camera_common_data *s_data = to_camera_common_data(&client->dev);
@@ -791,7 +795,7 @@ static int imx477_remove(struct i2c_client *client)
if (!s_data) {
dev_err(&client->dev, "camera common data is NULL\n");
#if KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return -EINVAL;
#else
return;
@@ -801,7 +805,7 @@ static int imx477_remove(struct i2c_client *client)
tegracam_v4l2subdev_unregister(priv->tc_dev);
tegracam_device_unregister(priv->tc_dev);
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0)
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0;
#endif
}

View File

@@ -6,6 +6,8 @@
*
*/
#include <nvidia/conftest.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <linux/gpio.h>
@@ -1146,7 +1148,7 @@ static const struct v4l2_subdev_internal_ops ov5693_subdev_internal_ops = {
.open = ov5693_open,
};
#if KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE
#if defined(NV_I2C_DRIVER_STRUCT_PROBE_WITHOUT_I2C_DEVICE_ID_ARG) /* Linux 6.3 */
static int ov5693_probe(struct i2c_client *client)
#else
static int ov5693_probe(struct i2c_client *client,
@@ -1236,7 +1238,7 @@ fail:
return err;
}
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE)
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static int
ov5693_remove(struct i2c_client *client)
#else
@@ -1248,7 +1250,7 @@ ov5693_remove(struct i2c_client *client)
struct camera_common_data *s_data = to_camera_common_data(&client->dev);
if (!s_data)
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE)
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return -EINVAL;
#else
return;
@@ -1264,7 +1266,7 @@ ov5693_remove(struct i2c_client *client)
ov5693_eeprom_device_release(priv);
mutex_destroy(&priv->streaming_lock);
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE)
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0;
#endif
}

View File

@@ -5,6 +5,8 @@
* Copyright (c) 2016-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*/
#include <nvidia/conftest.h>
#include <linux/seq_file.h>
#include <linux/debugfs.h>
#include <linux/i2c.h>
@@ -258,7 +260,7 @@ static struct regmap_config pca9570_regmap_config = {
.cache_type = REGCACHE_RBTREE,
};
#if KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE
#if defined(NV_I2C_DRIVER_STRUCT_PROBE_WITHOUT_I2C_DEVICE_ID_ARG) /* Linux 6.3 */
static int pca9570_probe(struct i2c_client *client)
#else
static int pca9570_probe(struct i2c_client *client,
@@ -308,7 +310,7 @@ static int pca9570_probe(struct i2c_client *client,
return err;
}
#if KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static int pca9570_remove(struct i2c_client *client)
#else
static void pca9570_remove(struct i2c_client *client)
@@ -319,7 +321,7 @@ static void pca9570_remove(struct i2c_client *client)
client = NULL;
}
#if KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0;
#endif
}

View File

@@ -4,6 +4,8 @@
* virtual_i2c_mux.c - virtual i2c mux driver for P3762 & P3783 GMSL boards.
*/
#include <nvidia/conftest.h>
#include <linux/i2c.h>
#include <linux/i2c-mux.h>
#include <linux/module.h>
@@ -47,7 +49,7 @@ static int virtual_i2c_mux_deselect(struct i2c_mux_core *muxc, u32 chan)
return ret;
}
#if KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE
#if defined(NV_I2C_DRIVER_STRUCT_PROBE_WITHOUT_I2C_DEVICE_ID_ARG) /* Linux 6.3 */
static int virtual_i2c_mux_probe(struct i2c_client *client)
#else
static int virtual_i2c_mux_probe(struct i2c_client *client,
@@ -104,7 +106,7 @@ err_parent:
return ret;
}
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE)
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static int virtual_i2c_mux_remove(struct i2c_client *client)
#else
static void virtual_i2c_mux_remove(struct i2c_client *client)
@@ -114,7 +116,7 @@ static void virtual_i2c_mux_remove(struct i2c_client *client)
i2c_mux_del_adapters(muxc);
i2c_put_adapter(muxc->parent);
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE)
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0;
#endif
}

View File

@@ -1,8 +1,10 @@
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
ifdef CONFIG_MEDIA_SUPPORT
obj-m += cdi/
obj-m += tpg/
endif
obj-m += isc/
obj-m += camera/
obj-m += tpg/
obj-m += cam_fsync/

View File

@@ -1,6 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (c) 2022-2023, NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2022-2024, NVIDIA CORPORATION. All rights reserved.
ifdef CONFIG_MEDIA_SUPPORT
ifeq ($(findstring ack_src,$(NV_BUILD_KERNEL_OPTIONS)),)
LINUXINCLUDE += -I$(srctree.nvidia-oot)/drivers/video/tegra/camera
LINUXINCLUDE += -I$(srctree.nvidia-oot)/drivers/media/platform/tegra
@@ -32,3 +33,4 @@ tegra-camera-objs += fusa-capture/capture-isp.o
obj-m += tegra-camera.o
obj-m += tests/
endif
endif

View File

@@ -2,9 +2,11 @@
/*
* NVIDIA Tegra CSI Device
*
* Copyright (c) 2015-2022, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2015-2024, NVIDIA CORPORATION. All rights reserved.
*/
#include <nvidia/conftest.h>
#include <linux/clk.h>
#include <linux/device.h>
#include <linux/gpio/consumer.h>
@@ -685,6 +687,9 @@ static int tegra_csi_set_format(struct v4l2_subdev *subdev,
}
static int tegra_csi_g_frame_interval(struct v4l2_subdev *sd,
#if defined(NV_V4L2_SUBDEV_PAD_OPS_STRUCT_HAS_GET_FRAME_INTERVAL)
struct v4l2_subdev_state *sd_state,
#endif
struct v4l2_subdev_frame_interval *vfi)
{
struct tegra_csi_channel *chan = to_csi_chan(sd);
@@ -716,10 +721,15 @@ static int tegra_csi_enum_mbus_code(struct v4l2_subdev *sd,
static struct v4l2_subdev_video_ops tegra_csi_video_ops = {
.s_stream = tegra_csi_s_stream,
.g_input_status = tegra_csi_g_input_status,
#if !defined(NV_V4L2_SUBDEV_PAD_OPS_STRUCT_HAS_GET_FRAME_INTERVAL)
.g_frame_interval = tegra_csi_g_frame_interval,
#endif
};
static struct v4l2_subdev_pad_ops tegra_csi_pad_ops = {
#if defined(NV_V4L2_SUBDEV_PAD_OPS_STRUCT_HAS_GET_FRAME_INTERVAL)
.get_frame_interval = tegra_csi_g_frame_interval,
#endif
.get_fmt = tegra_csi_get_format,
.set_fmt = tegra_csi_set_format,
.enum_mbus_code = tegra_csi_enum_mbus_code,

View File

@@ -1,10 +1,10 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2017-2023 NVIDIA Corporation. All rights reserved.
// SPDX-License-Identifier: GPL-2.0-only
// SPDX-FileCopyrightText: Copyright (c) 2017-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
/**
* @file drivers/media/platform/tegra/camera/fusa-capture/capture-vi-channel.c
*
* @brief VI channel character device driver for the T186/T194 Camera RTCPU
* @brief VI channel character device driver for the T234 Camera RTCPU
* platform.
*/
@@ -204,11 +204,7 @@ struct tegra_vi_channel *vi_channel_open_ex(
return ERR_PTR(-ENOMEM);
chan->drv = chan_drv;
if (chan_drv->use_legacy_path) {
chan->dev = chan_drv->dev;
chan->ndev = chan_drv->ndev;
} else
chan->vi_capture_pdev = chan_drv->vi_capture_pdev;
chan->vi_capture_pdev = chan_drv->vi_capture_pdev;
chan->ops = chan_drv->ops;
@@ -390,17 +386,14 @@ static long vi_channel_ioctl(
if (copy_from_user(&setup, ptr, sizeof(setup)))
break;
if (chan->drv->use_legacy_path == false) {
vi_get_nvhost_device(chan, &setup);
if (chan->dev == NULL) {
dev_err(&chan->vi_capture_pdev->dev,
"%s: channel device is NULL",
__func__);
return -EINVAL;
}
vi_get_nvhost_device(chan, &setup);
if (chan->dev == NULL) {
dev_err(&chan->vi_capture_pdev->dev,
"%s: channel device is NULL",
__func__);
return -EINVAL;
}
if (setup.request_size < sizeof(struct capture_descriptor)) {
dev_err(chan->dev,
"request size is too small to fit capture descriptor\n");
@@ -650,16 +643,10 @@ int vi_channel_drv_register(
if (unlikely(chan_drv == NULL))
return -ENOMEM;
if (strstr(ndev->name, "tegra-capture-vi") == NULL) {
chan_drv->use_legacy_path = true;
chan_drv->dev = &ndev->dev;
chan_drv->ndev = ndev;
} else {
chan_drv->use_legacy_path = false;
chan_drv->dev = NULL;
chan_drv->ndev = NULL;
chan_drv->vi_capture_pdev = ndev;
}
chan_drv->dev = NULL;
chan_drv->ndev = NULL;
chan_drv->vi_capture_pdev = ndev;
chan_drv->num_channels = max_vi_channels;
mutex_init(&chan_drv->lock);
@@ -676,9 +663,7 @@ int vi_channel_drv_register(
for (i = 0; i < chan_drv->num_channels; i++) {
dev_t devt = MKDEV(vi_channel_major, i);
struct device *dev =
(chan_drv->use_legacy_path)?chan_drv->dev :
&chan_drv->vi_capture_pdev->dev;
struct device *dev = &chan_drv->vi_capture_pdev->dev;
device_create(vi_channel_class, dev, devt, NULL,
"capture-vi-channel%u", i);
}
@@ -725,7 +710,8 @@ void vi_channel_drv_unregister(
mutex_lock(&chdrv_lock);
chan_drv = chdrv_;
chdrv_ = NULL;
WARN_ON(chan_drv->dev != dev);
WARN_ON(&chan_drv->vi_capture_pdev->dev != dev);
mutex_unlock(&chdrv_lock);
for (i = 0; i < chan_drv->num_channels; i++) {
@@ -734,7 +720,7 @@ void vi_channel_drv_unregister(
device_destroy(vi_channel_class, devt);
}
devm_kfree(chan_drv->dev, chan_drv);
devm_kfree(&chan_drv->vi_capture_pdev->dev, chan_drv);
}
EXPORT_SYMBOL(vi_channel_drv_unregister);

View File

@@ -1,10 +1,10 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2017-2023 NVIDIA Corporation. All rights reserved.
// SPDX-License-Identifier: GPL-2.0-only
// SPDX-FileCopyrightText: Copyright (c) 2017-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
/**
* @file drivers/media/platform/tegra/camera/fusa-capture/capture-vi.c
*
* @brief VI channel operations for the T186/T194 Camera RTCPU platform.
* @brief VI channel operations for the T234 Camera RTCPU platform.
*/
#include <linux/completion.h>
@@ -448,10 +448,7 @@ int vi_capture_init(
struct platform_device *rtc_pdev;
struct device *dev;
if (chan->drv->use_legacy_path)
dev = chan->dev;
else
dev = &chan->vi_capture_pdev->dev;
dev = &chan->vi_capture_pdev->dev;
dev_dbg(dev, "%s++\n", __func__);
dn = of_find_node_by_path("tegra-camera-rtcpu");
@@ -595,10 +592,7 @@ int vi_capture_setup(
uint32_t vi_inst = 0;
struct device *dev;
if (chan->drv->use_legacy_path)
dev = chan->dev;
else
dev = &chan->vi_capture_pdev->dev;
dev = &chan->vi_capture_pdev->dev;
if (setup->csi_stream_id >= MAX_NVCSI_STREAM_IDS ||
setup->virtual_channel_id >= MAX_VIRTUAL_CHANNEL_PER_STREAM) {
@@ -1664,7 +1658,7 @@ static int capture_vi_probe(struct platform_device *pdev)
err = vi_channel_drv_register(pdev, info->max_vi_channels);
if (err) {
vi_channel_drv_exit();
vi_channel_drv_exit();
goto cleanup;
}
@@ -1702,7 +1696,10 @@ static int capture_vi_remove(struct platform_device *pdev)
for (ii = 0; ii < info->num_vi_devices; ii++)
put_device(&info->vi_pdevices[ii]->dev);
vi_channel_drv_exit();
vi_channel_drv_unregister(&pdev->dev);
tegra_vi_media_controller_cleanup(&info->vi_common.mc_vi);
vi_channel_drv_exit();
return 0;
}

View File

@@ -2,7 +2,7 @@
/*
* tegracam_ctrls - control framework for tegra camera drivers
*
* Copyright (c) 2017-2022, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2017-2023, NVIDIA CORPORATION. All rights reserved.
*/
#include <linux/nospec.h>
@@ -326,7 +326,7 @@ static int tegracam_set_ctrls(struct tegracam_ctrl_handler *handler,
/* For controls that require sensor to be on */
switch (ctrl->id) {
case TEGRA_CAMERA_CID_GAIN:
if (*ctrl->p_new.p_s64 == ctrlprops->min_gain_val - 1)
if (*ctrl->p_new.p_s64 == ctrlprops->max_gain_val + 1)
return 0;
err = ops->set_gain(tc_dev, *ctrl->p_new.p_s64);
break;
@@ -334,7 +334,7 @@ static int tegracam_set_ctrls(struct tegracam_ctrl_handler *handler,
err = ops->set_frame_rate(tc_dev, *ctrl->p_new.p_s64);
break;
case TEGRA_CAMERA_CID_EXPOSURE:
if (*ctrl->p_new.p_s64 == ctrlprops->min_exp_time.val - 1)
if (*ctrl->p_new.p_s64 == ctrlprops->max_exp_time.val + 1)
return 0;
err = ops->set_exposure(tc_dev, *ctrl->p_new.p_s64);
break;
@@ -607,8 +607,8 @@ int tegracam_init_ctrl_ranges_by_mode(
switch (ctrl->id) {
case TEGRA_CAMERA_CID_GAIN:
err = v4l2_ctrl_modify_range(ctrl,
ctrlprops->min_gain_val - 1,
ctrlprops->max_gain_val,
ctrlprops->min_gain_val,
ctrlprops->max_gain_val + 1,
ctrlprops->step_gain_val,
ctrlprops->default_gain);
break;
@@ -621,8 +621,8 @@ int tegracam_init_ctrl_ranges_by_mode(
break;
case TEGRA_CAMERA_CID_EXPOSURE:
err = v4l2_ctrl_modify_range(ctrl,
ctrlprops->min_exp_time.val - 1,
ctrlprops->max_exp_time.val,
ctrlprops->min_exp_time.val,
ctrlprops->max_exp_time.val + 1,
ctrlprops->step_exp_time.val,
ctrlprops->default_exp_time.val);
break;

View File

@@ -1,8 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: GPL-2.0-only
// SPDX-FileCopyrightText: Copyright (c) 2015-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
/*
* NVIDIA Tegra Video Input Device
*
* Copyright (c) 2015-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*/
#include <linux/atomic.h>
@@ -1023,14 +1022,21 @@ static int
tegra_channel_querycap(struct file *file, void *fh, struct v4l2_capability *cap)
{
struct tegra_channel *chan = video_drvdata(file);
ssize_t len;
int ret = 0;
cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
cap->device_caps |= V4L2_CAP_EXT_PIX_FORMAT;
cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
strlcpy(cap->driver, "tegra-video", sizeof(cap->driver));
strlcpy(cap->card, chan->video->name, sizeof(cap->card));
len = strscpy(cap->driver, "tegra-video", sizeof(cap->driver));
if (len < 0)
return -ENAMETOOLONG;
len = strscpy(cap->card, chan->video->name, sizeof(cap->card));
if (len < 0)
return -ENAMETOOLONG;
ret = snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s:%u",
dev_name(chan->vi->dev), chan->port[0]);
if (ret < 0)

View File

@@ -2,8 +2,11 @@
/*
* NVIDIA Media controller graph management
*
* Copyright (c) 2015-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* Copyright (c) 2015-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*/
#include <nvidia/conftest.h>
#include <linux/clk.h>
#include <linux/list.h>
#include <linux/of.h>
@@ -13,7 +16,6 @@
#include <linux/regulator/consumer.h>
#include <linux/reset.h>
#include <linux/slab.h>
#include <linux/version.h>
#include <soc/tegra/fuse.h>
#include <media/media-device.h>
#include <media/v4l2-async.h>
@@ -341,7 +343,7 @@ register_device_error:
return ret;
}
#if defined(NV_V4L2_ASYNC_SUBDEV_RENAME)
#if defined(NV_V4L2_ASYNC_CONNECTION_STRUCT_PRESENT) /* Linux 6.5 */
static int tegra_vi_graph_notify_bound(struct v4l2_async_notifier *notifier,
struct v4l2_subdev *subdev,
struct v4l2_async_connection *asd)
@@ -380,7 +382,7 @@ static int tegra_vi_graph_notify_bound(struct v4l2_async_notifier *notifier,
return -EINVAL;
}
#if defined(NV_V4L2_ASYNC_SUBDEV_RENAME)
#if defined(NV_V4L2_ASYNC_CONNECTION_STRUCT_PRESENT) /* Linux 6.5 */
static void tegra_vi_graph_notify_unbind(struct v4l2_async_notifier *notifier,
struct v4l2_subdev *subdev,
struct v4l2_async_connection *asd)
@@ -423,7 +425,7 @@ void tegra_vi_graph_cleanup(struct tegra_mc_vi *vi)
list_for_each_entry(chan, &vi->vi_chans, list) {
#if defined(CONFIG_V4L2_ASYNC)
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
#if defined(NV_V4L2_ASYNC_NOTIFIER_INIT_PRESENT)
v4l2_async_notifier_unregister(&chan->notifier);
#else
v4l2_async_nf_unregister(&chan->notifier);
@@ -477,12 +479,14 @@ static int tegra_vi_graph_parse_one(struct tegra_channel *chan,
}
entity->node = remote;
#if defined(NV_V4L2_ASYNC_MATCH_FWNODE_RENAME)
#if !defined(NV_V4L2_ASYNC_CONNECTION_STRUCT_PRESENT) /* Linux 6.5 */
#if defined(NV_V4L2_ASYNC_MATCH_TYPE_ENUM_PRESENT) /* Linux 6.5 */
entity->asd.match.type = V4L2_ASYNC_MATCH_TYPE_FWNODE;
#else
entity->asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
#endif
entity->asd.match.fwnode = of_fwnode_handle(remote);
#endif
list_add_tail(&entity->list, &chan->entities);
chan->num_subdevs++;
@@ -638,12 +642,14 @@ int tegra_vi_graph_init(struct tegra_mc_vi *vi)
/* Add the remote entity of this endpoint */
entity->node = remote;
#if defined(NV_V4L2_ASYNC_MATCH_FWNODE_RENAME)
#if !defined(NV_V4L2_ASYNC_CONNECTION_STRUCT_PRESENT) /* Linux 6.5 */
#if defined(NV_V4L2_ASYNC_MATCH_TYPE_ENUM_PRESENT) /* Linux 6.5 */
entity->asd.match.type = V4L2_ASYNC_MATCH_TYPE_FWNODE;
#else
entity->asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
#endif
entity->asd.match.fwnode = of_fwnode_handle(remote);
#endif
list_add_tail(&entity->list, &chan->entities);
chan->num_subdevs++;
chan->notifier.ops = chan->notifier.ops ? chan->notifier.ops : &vi_chan_notify_ops;
@@ -664,39 +670,44 @@ int tegra_vi_graph_init(struct tegra_mc_vi *vi)
i = 0;
#if defined(CONFIG_V4L2_ASYNC)
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
#if defined(NV_V4L2_ASYNC_NOTIFIER_INIT_PRESENT)
v4l2_async_notifier_init(&chan->notifier);
list_for_each_entry(entity, &chan->entities, list)
__v4l2_async_notifier_add_subdev(&chan->notifier, &entity->asd);
#else
#if defined (NV_V4L2_ASYNC_NF_SUBDEVICE_INIT_RENAME)
v4l2_async_subdev_nf_init(&chan->notifier, tegra_channel_find_linked_csi_subdev(chan));
list_for_each_entry(entity, &chan->entities, list) {
struct v4l2_async_connection *asd;
asd = v4l2_async_nf_add_fwnode_remote(&chan->notifier, of_fwnode_handle(remote),
struct v4l2_async_connection);
if (IS_ERR(asd)) {
ret = PTR_ERR(asd);
goto done;
}
}
#if defined(NV_V4L2_ASYNC_NF_INIT_HAS_V4L2_DEV_ARG) /* Linux 6.6 */
v4l2_async_nf_init(&chan->notifier, &vi->v4l2_dev);
#else
v4l2_async_nf_init(&chan->notifier);
#endif
#if defined(NV_V4L2_ASYNC_NF_ADD_SUBDEV_PRESENT) /* Linux 6.6 */
list_for_each_entry(entity, &chan->entities, list)
__v4l2_async_nf_add_subdev(&chan->notifier, &entity->asd);
#endif
#endif
#else
list_for_each_entry(entity, &chan->entities, list) {
struct v4l2_async_connection *asc;
asc = v4l2_async_nf_add_fwnode(&chan->notifier, of_fwnode_handle(entity->node),
struct v4l2_async_connection);
if (IS_ERR(asc))
asc = NULL;
entity->asc = asc;
}
#endif /* NV_V4L2_ASYNC_NF_ADD_SUBDEV_PRESENT */
#endif /* NV_V4L2_ASYNC_NOTIFIER_INIT_PRESENT */
chan->link_status = 0;
chan->subdevs_bound = 0;
/* Register the async notifier for this channel */
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
#if defined(NV_V4L2_ASYNC_NOTIFIER_INIT_PRESENT)
ret = v4l2_async_notifier_register(&vi->v4l2_dev,
&chan->notifier);
#else
#if defined (NV_V4L2_ASYNC_NF_SUBDEVICE_INIT_RENAME)
#if defined (NV_V4L2_ASYNC_NF_INIT_HAS_V4L2_DEV_ARG) /* Linux 6.6 */
ret = v4l2_async_nf_register(&chan->notifier);
if (ret < 0)
v4l2_async_nf_cleanup(&chan->notifier);
#else
ret = v4l2_async_nf_register(&vi->v4l2_dev,
&chan->notifier);
@@ -705,9 +716,9 @@ int tegra_vi_graph_init(struct tegra_mc_vi *vi)
#else
dev_err(vi->dev, "CONFIG_V4L2_ASYNC is not enabled!\n");
ret = -ENOTSUPP;
#endif
#endif /* CONFIG_V4L2_ASYNC */
if (ret < 0) {
dev_err(vi->dev, "notifier registration failed\n");
dev_err(vi->dev, "notifier registration failed %d\n", ret);
goto done;
}

View File

@@ -1,8 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
// SPDX-License-Identifier: GPL-2.0-only
// SPDX-FileCopyrightText: Copyright (c) 2015-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
/*
* Tegra Video Input device common APIs
*
* Copyright (c) 2015-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*/
#include <linux/init.h>
@@ -116,11 +115,15 @@ static void tegra_vi_notify(struct v4l2_subdev *sd,
int tegra_vi_v4l2_init(struct tegra_mc_vi *vi)
{
ssize_t len;
int ret;
vi->media_dev.dev = vi->dev;
strlcpy(vi->media_dev.model, "NVIDIA Tegra Video Input Device",
len = strscpy(vi->media_dev.model, "NVIDIA Tegra Video Input Device",
sizeof(vi->media_dev.model));
if (len < 0)
return -ENAMETOOLONG;
vi->media_dev.hw_revision = 3;
media_device_init(&vi->media_dev);

View File

@@ -2,7 +2,7 @@
/*
* Tegra Video Input 5 device common APIs
*
* Copyright (c) 2016-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* Copyright (c) 2016-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*/
#include <linux/errno.h>
@@ -319,6 +319,8 @@ static int tegra_channel_capture_setup(struct tegra_channel *chan, unsigned int
chan->request[vi_port] = dma_alloc_coherent(chan->tegra_vi_channel[vi_port]->rtcpu_dev,
setup.queue_depth * setup.request_size,
&setup.iova, GFP_KERNEL);
chan->request_iova[vi_port] = setup.iova;
if (chan->request[vi_port] == NULL) {
dev_err(chan->vi->dev, "dma_alloc_coherent failed\n");
return -ENOMEM;
@@ -967,6 +969,24 @@ static int vi5_channel_stop_streaming(struct vb2_queue *vq)
dev_err(&chan->video->dev,
"vi capture release failed\n");
/* Release capture requests */
if (chan->request[vi_port] != NULL) {
dma_free_coherent(chan->tegra_vi_channel[vi_port]->rtcpu_dev,
chan->capture_queue_depth * sizeof(struct capture_descriptor),
chan->request[vi_port], chan->request_iova[vi_port]);
}
chan->request[vi_port] = NULL;
/* Release emd data buffers */
if (chan->emb_buf_size > 0) {
struct device *vi_unit_dev;
vi5_unit_get_device_handle(chan->vi->ndev, chan->port[0],\
&vi_unit_dev);
dma_free_coherent(vi_unit_dev, chan->emb_buf_size,
chan->emb_buf_addr, chan->emb_buf);
chan->emb_buf_size = 0;
}
vi_channel_close_ex(chan->vi_channel_id[vi_port],
chan->tegra_vi_channel[vi_port]);
chan->tegra_vi_channel[vi_port] = NULL;
@@ -974,6 +994,7 @@ static int vi5_channel_stop_streaming(struct vb2_queue *vq)
/* release all remaining buffers to v4l2 */
tegra_channel_queued_buf_done(chan, VB2_BUF_STATE_ERROR, false);
}
return 0;

View File

@@ -1,10 +1,8 @@
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
ifneq ($(CONFIG_TEGRA_GPIO_LEGACY_DISABLE),y)
obj-m += cdi_gpio.o
obj-m += cdi_mgr.o
endif
obj-m += cdi_dev.o
obj-m += cdi_pwm.o
ifeq ($(findstring ack_src,$(NV_BUILD_KERNEL_OPTIONS)),)

View File

@@ -1,6 +1,8 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2015-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#include <nvidia/conftest.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/fs.h>
@@ -564,7 +566,7 @@ static void cdi_dev_get_cim_ver(struct device_node *np, struct cdi_dev_info *inf
}
}
#if KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE
#if defined(NV_I2C_DRIVER_STRUCT_PROBE_WITHOUT_I2C_DEVICE_ID_ARG) /* Linux 6.3 */
static int cdi_dev_probe(struct i2c_client *client)
#else
static int cdi_dev_probe(struct i2c_client *client,
@@ -805,7 +807,7 @@ static int cdi_dev_probe(struct i2c_client *client,
return 0;
}
#if KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static int cdi_dev_remove(struct i2c_client *client)
#else
static void cdi_dev_remove(struct i2c_client *client)
@@ -826,7 +828,7 @@ static void cdi_dev_remove(struct i2c_client *client)
if (info->cdev.dev)
cdev_del(&info->cdev);
#if KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0;
#endif
}

View File

@@ -1,6 +1,8 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2017-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#include <nvidia/conftest.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/of.h>
@@ -40,6 +42,9 @@ static struct gpio_chip *cdi_gpio_get_chip(struct platform_device *pdev,
struct cdi_gpio_plat_data *pd)
{
struct gpio_chip *gc = NULL;
#if !defined(NV_GPIOCHIP_FIND_PRESENT) /* Linux 6.7 */
struct gpio_device *gdev;
#endif
char name[MAX_STR_SIZE];
if (strlen(pd->gpio_prnt_chip) > MAX_STR_SIZE) {
@@ -49,7 +54,15 @@ static struct gpio_chip *cdi_gpio_get_chip(struct platform_device *pdev,
}
strcpy(name, pd->gpio_prnt_chip);
#if defined(NV_GPIOCHIP_FIND_PRESENT) /* Linux 6.7 */
gc = gpiochip_find(name, cdi_gpio_chip_match);
#else
gdev = gpio_device_find(name, cdi_gpio_chip_match);
if (gdev) {
gc = gpio_device_get_chip(gdev);
gpio_device_put(gdev);
}
#endif
if (!gc) {
dev_err(&pdev->dev, "%s: unable to find gpio parent chip %s\n",
__func__, pd->gpio_prnt_chip);
@@ -275,7 +288,10 @@ static int cdi_gpio_probe(struct platform_device *pdev)
gc->base = -1;
gc->ngpio = pd->max_gpio;
gc->label = "cdi-gpio";
gc->parent = &pdev->dev;
#if defined(NV_GPIO_CHIP_STRUCT_HAS_OF_NODE_PRESENT) /* Linux 6.2 */
gc->of_node = pdev->dev.of_node;
#endif
gc->owner = THIS_MODULE;
err = gpiochip_add_data(gc, cdi_gpio);

View File

@@ -14,6 +14,7 @@
#include <linux/platform_device.h>
#include <linux/device.h>
#include <linux/of_irq.h>
#include <linux/of.h>
#include <linux/interrupt.h>
#include <asm/siginfo.h>
#include <linux/rcupdate.h>
@@ -30,7 +31,6 @@
#include <media/cdi-mgr.h>
#include <linux/gpio/consumer.h>
#include <linux/semaphore.h>
#include <linux/version.h>
#include <asm/barrier.h>
@@ -1328,15 +1328,23 @@ static int cdi_mgr_of_get_grp_gpio(
struct device *dev, struct device_node *np,
const char *name, int size, u32 *grp, u32 *flags)
{
char prop_name[32]; /* 32 is max size of property name */
int num, i;
num = of_gpio_named_count(np, name);
dev_dbg(dev, " num gpios of %s: %d\n", name, num);
snprintf(prop_name, sizeof(prop_name), "%s-gpios", name);
num = gpiod_count(dev, name);
dev_dbg(dev, " num gpios of %s: %d\n", prop_name, num);
if (num < 0)
return 0;
for (i = 0; (i < num) && (i < size); i++) {
grp[i] = of_get_named_gpio_flags(np, name, i, &flags[i]);
#if defined(NV_OF_GET_NAMED_GPIO_FLAGS_PRESENT) /* Linux 6.2 */
grp[i] = of_get_named_gpio_flags(np, prop_name, i, &flags[i]);
#else
grp[i] = of_get_named_gpio(np, prop_name, i);
flags[i] = 0;
#endif
if ((int)grp[i] < 0) {
dev_err(dev, "%s: gpio[%d] invalid\n", __func__, i);
return -EINVAL;
@@ -1446,13 +1454,13 @@ static struct cdi_mgr_platform_data *of_cdi_mgr_pdata(struct platform_device
dev_dbg(&pdev->dev, " csiport: %d\n", pd->csi_port);
pd->num_pwr_gpios = cdi_mgr_of_get_grp_gpio(
&pdev->dev, child_np, "pwdn-gpios",
&pdev->dev, child_np, "pwdn",
ARRAY_SIZE(pd->pwr_gpios), pd->pwr_gpios, pd->pwr_flags);
if (pd->num_pwr_gpios < 0)
return ERR_PTR(pd->num_pwr_gpios);
pd->num_mcdi_gpios = cdi_mgr_of_get_grp_gpio(
&pdev->dev, child_np, "mcdi-gpios",
&pdev->dev, child_np, "mcdi",
ARRAY_SIZE(pd->mcdi_gpios), pd->mcdi_gpios, pd->mcdi_flags);
if (pd->num_mcdi_gpios < 0)
return ERR_PTR(pd->num_mcdi_gpios);
@@ -1488,10 +1496,10 @@ static struct cdi_mgr_platform_data *of_cdi_mgr_pdata(struct platform_device
return pd;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0)
static char *cdi_mgr_devnode(struct device *dev, umode_t *mode)
#else
#if defined(NV_CLASS_STRUCT_DEVNODE_HAS_CONST_DEV_ARG) /* Linux v6.2 */
static char *cdi_mgr_devnode(const struct device *dev, umode_t *mode)
#else
static char *cdi_mgr_devnode(struct device *dev, umode_t *mode)
#endif
{
if (!mode)
@@ -1652,13 +1660,8 @@ static int cdi_mgr_configure_gpios(struct device *dev, struct cdi_mgr_priv *cdi_
}
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0)
cdi_mgr->gpios[i].desc = devm_fwnode_get_gpiod_from_child(dev,
"devblk", &child->fwnode, GPIOD_ASIS, NULL);
#else
cdi_mgr->gpios[i].desc = devm_fwnode_gpiod_get_index(dev,
&child->fwnode, "devblk", 0, GPIOD_ASIS, NULL);
#endif
if (IS_ERR(cdi_mgr->gpios[i].desc)) {
ret = PTR_ERR(cdi_mgr->gpios[i].desc);
if (ret < 0)

View File

@@ -1,5 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2016-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// Copyright (c) 2016-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#include <nvidia/conftest.h>
#include <linux/module.h>
#include <linux/of.h>
@@ -130,7 +132,9 @@ static const struct pwm_ops cdi_pwm_ops = {
.enable = cdi_pwm_enable,
.disable = cdi_pwm_disable,
#endif
#if defined(NV_PWM_OPS_STRUCT_HAS_OWNER) /* Linux 6.7 */
.owner = THIS_MODULE,
#endif
};
static int cdi_pwm_probe(struct platform_device *pdev)
@@ -159,10 +163,11 @@ static int cdi_pwm_probe(struct platform_device *pdev)
info->chip.dev = &pdev->dev;
info->chip.ops = &cdi_pwm_ops;
#if defined(NV_PWM_CHIP_STRUCT_HAS_BASE_ARG)
info->chip.base = -1;
#endif
info->chip.npwm = npwm;
info->chip.of_xlate = of_cdi_pwm_xlate;
info->chip.of_pwm_n_cells = 2;
info->force_on = force_on;
err = pwmchip_add(&info->chip);

View File

@@ -3,12 +3,7 @@
GCOV_PROFILE := y
LINUX_VERSION := $(shell expr $(VERSION) \* 256 + $(PATCHLEVEL))
LINUX_VERSION_6_3 := $(shell expr 6 \* 256 + 3)
ifneq ($(CONFIG_TEGRA_GPIO_LEGACY_DISABLE),y)
obj-m += isc_gpio.o
obj-m += isc_mgr.o
endif
obj-m += isc_dev.o
obj-m += isc_pwm.o

View File

@@ -1,6 +1,8 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2015-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#include <nvidia/conftest.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/fs.h>
@@ -427,7 +429,7 @@ static const struct file_operations isc_dev_fileops = {
.release = isc_dev_release,
};
#if KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE
#if defined(NV_I2C_DRIVER_STRUCT_PROBE_WITHOUT_I2C_DEVICE_ID_ARG) /* Linux 6.3 */
static int isc_dev_probe(struct i2c_client *client)
#else
static int isc_dev_probe(struct i2c_client *client,
@@ -512,7 +514,7 @@ static int isc_dev_probe(struct i2c_client *client,
return 0;
}
#if KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static int isc_dev_remove(struct i2c_client *client)
#else
static void isc_dev_remove(struct i2c_client *client)
@@ -533,7 +535,7 @@ static void isc_dev_remove(struct i2c_client *client)
if (info->cdev.dev)
cdev_del(&info->cdev);
#if KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE
#if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0;
#endif
}

View File

@@ -1,6 +1,8 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2017-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#include <nvidia/conftest.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/of.h>
@@ -41,6 +43,9 @@ static struct gpio_chip *isc_gpio_get_chip(struct platform_device *pdev,
{
struct gpio_chip *gc = NULL;
char name[MAX_STR_SIZE];
#if !defined(NV_GPIOCHIP_FIND_PRESENT) /* Linux 6.7 */
struct gpio_device *gdev;
#endif
if (strlen(pd->gpio_prnt_chip) > MAX_STR_SIZE) {
dev_err(&pdev->dev, "%s: gpio chip name is too long: %s\n",
@@ -49,7 +54,15 @@ static struct gpio_chip *isc_gpio_get_chip(struct platform_device *pdev,
}
strcpy(name, pd->gpio_prnt_chip);
#if defined(NV_GPIOCHIP_FIND_PRESENT) /* Linux 6.7 */
gc = gpiochip_find(name, isc_gpio_chip_match);
#else
gdev = gpio_device_find(name, isc_gpio_chip_match);
if (gdev) {
gc = gpio_device_get_chip(gdev);
gpio_device_put(gdev);
}
#endif
if (!gc) {
dev_err(&pdev->dev, "%s: unable to find gpio parent chip %s\n",
__func__, pd->gpio_prnt_chip);
@@ -275,7 +288,10 @@ static int isc_gpio_probe(struct platform_device *pdev)
gc->base = -1;
gc->ngpio = pd->max_gpio;
gc->label = "isc-gpio";
gc->parent = &pdev->dev;
#if defined(NV_GPIO_CHIP_STRUCT_HAS_OF_NODE_PRESENT) /* Linux 6.2 */
gc->of_node = pdev->dev.of_node;
#endif
gc->owner = THIS_MODULE;
err = gpiochip_add_data(gc, isc_gpio);

View File

@@ -9,6 +9,7 @@
#include <linux/slab.h>
#include <linux/gpio.h>
#include <linux/of_gpio.h>
#include <linux/of.h>
#include <linux/regmap.h>
#include <linux/delay.h>
#include <linux/platform_device.h>
@@ -18,7 +19,6 @@
#include <asm/siginfo.h>
#include <linux/rcupdate.h>
#include <linux/sched.h>
#include <linux/version.h>
#include <linux/sched/signal.h>
#include <linux/uaccess.h>
#include <linux/atomic.h>
@@ -813,15 +813,23 @@ static int isc_mgr_of_get_grp_gpio(
struct device *dev, struct device_node *np,
const char *name, int size, u32 *grp, u32 *flags)
{
char prop_name[32]; /* 32 is max size of property name */
int num, i;
num = of_gpio_named_count(np, name);
dev_dbg(dev, " num gpios of %s: %d\n", name, num);
snprintf(prop_name, sizeof(prop_name), "%s-gpios", name);
num = gpiod_count(dev, name);
dev_dbg(dev, " num gpios of %s: %d\n", prop_name, num);
if (num < 0)
return 0;
for (i = 0; (i < num) && (i < size); i++) {
grp[i] = of_get_named_gpio_flags(np, name, i, &flags[i]);
#if defined(NV_OF_GET_NAMED_GPIO_FLAGS_PRESENT) /* Linux 6.2 */
grp[i] = of_get_named_gpio_flags(np, prop_name, i, &flags[i]);
#else
grp[i] = of_get_named_gpio(np, prop_name, i);
flags[i] = 0;
#endif
if ((int)grp[i] < 0) {
dev_err(dev, "%s: gpio[%d] invalid\n", __func__, i);
return -EINVAL;
@@ -924,13 +932,13 @@ static struct isc_mgr_platform_data *of_isc_mgr_pdata(struct platform_device
dev_dbg(&pdev->dev, " csiport: %d\n", pd->csi_port);
pd->num_pwr_gpios = isc_mgr_of_get_grp_gpio(
&pdev->dev, np, "pwdn-gpios",
&pdev->dev, np, "pwdn",
ARRAY_SIZE(pd->pwr_gpios), pd->pwr_gpios, pd->pwr_flags);
if (pd->num_pwr_gpios < 0)
return ERR_PTR(pd->num_pwr_gpios);
pd->num_misc_gpios = isc_mgr_of_get_grp_gpio(
&pdev->dev, np, "misc-gpios",
&pdev->dev, np, "misc",
ARRAY_SIZE(pd->misc_gpios), pd->misc_gpios, pd->misc_flags);
if (pd->num_misc_gpios < 0)
return ERR_PTR(pd->num_misc_gpios);
@@ -957,10 +965,10 @@ static struct isc_mgr_platform_data *of_isc_mgr_pdata(struct platform_device
return pd;
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0))
static char *isc_mgr_devnode(struct device *dev, umode_t *mode)
#else
#if defined(NV_CLASS_STRUCT_DEVNODE_HAS_CONST_DEV_ARG) /* Linux v6.2 */
static char *isc_mgr_devnode(const struct device *dev, umode_t *mode)
#else
static char *isc_mgr_devnode(struct device *dev, umode_t *mode)
#endif
{
if (!mode)

View File

@@ -1,5 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2016-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// Copyright (c) 2016-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#include <nvidia/conftest.h>
#include <linux/module.h>
#include <linux/of.h>
@@ -130,7 +132,9 @@ static const struct pwm_ops isc_pwm_ops = {
.enable = isc_pwm_enable,
.disable = isc_pwm_disable,
#endif
#if defined(NV_PWM_OPS_STRUCT_HAS_OWNER) /* Linux 6.7 */
.owner = THIS_MODULE,
#endif
};
static int isc_pwm_probe(struct platform_device *pdev)
@@ -159,10 +163,11 @@ static int isc_pwm_probe(struct platform_device *pdev)
info->chip.dev = &pdev->dev;
info->chip.ops = &isc_pwm_ops;
#if defined(NV_PWM_CHIP_STRUCT_HAS_BASE_ARG)
info->chip.base = -1;
#endif
info->chip.npwm = npwm;
info->chip.of_xlate = of_isc_pwm_xlate;
info->chip.of_pwm_n_cells = 2;
info->force_on = force_on;
err = pwmchip_add(&info->chip);

View File

@@ -4,6 +4,8 @@
* Maxim MAX77851 MFD Driver
*/
#include <nvidia/conftest.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/mfd/core.h>
@@ -14,7 +16,6 @@
#include <linux/of_device.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <linux/version.h>
#define IS_MX_MASTER23(fps) ((fps == MX_FPS_MASTER2) || (fps == MX_FPS_MASTER3))
#define IS_MX_MASTER01(fps) ((fps == MX_FPS_MASTER0) || (fps == MX_FPS_MASTER1))
@@ -503,7 +504,7 @@ static void max77851_pm_power_off(void)
FPS_SW_COLD_RST, FPS_SW_COLD_RST);
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
#if defined(NV_I2C_DRIVER_STRUCT_PROBE_WITHOUT_I2C_DEVICE_ID_ARG) /* Linux 6.3 */
static int max77851_probe(struct i2c_client *client)
#else
static int max77851_probe(struct i2c_client *client,

View File

@@ -5,6 +5,8 @@
* Copyright (C) 2020-2023 NVIDIA CORPORATION. All rights reserved.
*/
#include <nvidia/conftest.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/mfd/core.h>
@@ -16,7 +18,6 @@
#include <linux/regmap.h>
#include <linux/slab.h>
#include <linux/err.h>
#include <linux/version.h>
static const struct resource rtc_resources[] = {
DEFINE_RES_IRQ(NVVRS_PSEQ_INT_SRC1_RTC),
@@ -185,7 +186,7 @@ static int nvvrs_pseq_vendor_info(struct nvvrs_pseq_chip *chip)
return 0;
}
#if KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE
#if defined(NV_I2C_DRIVER_STRUCT_PROBE_WITHOUT_I2C_DEVICE_ID_ARG) /* Linux 6.3 */
static int nvvrs_pseq_probe(struct i2c_client *client)
#else
static int nvvrs_pseq_probe(struct i2c_client *client,

View File

@@ -1,17 +1,13 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2022-2023, NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2022-2024, NVIDIA CORPORATION. All rights reserved.
ifeq ($(findstring ack_src,$(NV_BUILD_KERNEL_OPTIONS)),)
ifneq ($(CONFIG_TEGRA_IVC_LEGACY_DISABLE),y)
obj-m += mods/
endif
endif
obj-m += nvsciipc/
ifdef CONFIG_PCI
obj-m += tegra-pcie-dma-test.o
endif
ifneq ($(CONFIG_TEGRA_GPIO_LEGACY_DISABLE),y)
obj-m += bluedroid_pm.o
endif
obj-m += nvscic2c-pcie/
obj-m += ioctl_example.o

View File

@@ -1,5 +1,9 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2019-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved */
// SPDX-FileCopyrightText: Copyright (C) 2019-2023 NVIDIA CORPORATION. All rights reserved.
#include <nvidia/conftest.h>
#include <nvidia/conftest.h>
#include <linux/uaccess.h>
#include <linux/module.h>
@@ -13,7 +17,6 @@
#include <linux/delay.h>
#include <linux/timer.h>
#include <linux/of_gpio.h>
#include <linux/version.h>
#include "bluedroid_pm.h"
#define PROC_DIR "bluetooth/sleep"
@@ -209,7 +212,7 @@ static ssize_t lpm_read_proc(struct file *file, char __user *buf, size_t size,
loff_t *ppos)
{
char msg[50];
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0)
#if defined(NV_PDE_DATA_LOWER_CASE_PRESENT) /* Linux v5.17 */
struct bluedroid_pm_data *bluedroid_pm = pde_data(file_inode(file));
#else
struct bluedroid_pm_data *bluedroid_pm = PDE_DATA(file_inode(file));
@@ -225,7 +228,7 @@ static ssize_t lpm_write_proc(struct file *file, const char __user *buffer,
size_t count, loff_t *ppos)
{
char *buf;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0)
#if defined(NV_PDE_DATA_LOWER_CASE_PRESENT) /* Linux v5.17 */
struct bluedroid_pm_data *bluedroid_pm = pde_data(file_inode(file));
#else
struct bluedroid_pm_data *bluedroid_pm = PDE_DATA(file_inode(file));
@@ -341,7 +344,9 @@ static int bluedroid_pm_probe(struct platform_device *pdev)
int ret;
bool enable = false; /* off */
struct device_node *node;
#if defined(NV_OF_GET_NAMED_GPIO_FLAGS_PRESENT) /* Linux 6.2 */
enum of_gpio_flags of_flags;
#endif
unsigned long flags;
bluedroid_pm = devm_kzalloc(&pdev->dev, sizeof(*bluedroid_pm), GFP_KERNEL);
@@ -365,9 +370,14 @@ static int bluedroid_pm_probe(struct platform_device *pdev)
}
}
#if defined(NV_OF_GET_NAMED_GPIO_FLAGS_PRESENT) /* Linux 6.2 */
bluedroid_pm->gpio_reset =
of_get_named_gpio_flags(node, "bluedroid_pm,reset-gpio",
0, &of_flags);
#else
bluedroid_pm->gpio_reset =
of_get_named_gpio(node, "bluedroid_pm,reset-gpio", 0);
#endif
bluedroid_pm->gpio_shutdown =
of_get_named_gpio(node, "bluedroid_pm,shutdown-gpio", 0);
bluedroid_pm->host_wake =
@@ -380,7 +390,11 @@ static int bluedroid_pm_probe(struct platform_device *pdev)
&bluedroid_pm->resume_min_frequency);
if (gpio_is_valid(bluedroid_pm->gpio_reset)) {
#if defined(NV_OF_GET_NAMED_GPIO_FLAGS_PRESENT) /* Linux 6.2 */
flags = (of_flags == OF_GPIO_ACTIVE_LOW) ? GPIOF_ACTIVE_LOW : 0;
#else
flags = 0;
#endif
ret = gpio_request_one(bluedroid_pm->gpio_reset, flags,
"reset_gpio");
if (ret) {

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
/* SPDX-FileCopyrightText: Copyright (c) 2017-2023, NVIDIA CORPORATION. All rights reserved. */
/* SPDX-FileCopyrightText: Copyright (c) 2017-2024, NVIDIA CORPORATION. All rights reserved. */
#include <linux/device.h>
#include <linux/dmaengine.h>
@@ -279,9 +279,6 @@ int esc_mods_dma_set_config(struct mods_client *client,
config.src_maxburst = p_config->src_maxburst;
config.dst_maxburst = p_config->dst_maxburst;
config.device_fc = (p_config->device_fc == 0) ? false : true;
#if KERNEL_VERSION(5, 17, 0) > MODS_KERNEL_VERSION
config.slave_id = p_config->slave_id;
#endif
cl_debug(DEBUG_TEGRADMA,
"ch: %d dir [%d], addr[%p -> %p], burst [%d %d] width [%d %d]\n",
@@ -291,12 +288,6 @@ int esc_mods_dma_set_config(struct mods_client *client,
config.src_maxburst, config.dst_maxburst,
config.src_addr_width, config.dst_addr_width);
#if KERNEL_VERSION(5, 17, 0) > MODS_KERNEL_VERSION
cl_debug(DEBUG_TEGRADMA,
"slave id %d\n",
config.slave_id);
#endif
write_lock(&(p_mods_chan->lock));
err = dmaengine_slave_config(p_mods_chan->pch, &config);
write_unlock(&(p_mods_chan->lock));

View File

@@ -670,7 +670,7 @@ int esc_mods_send_trustzone_msg(struct mods_client *client,
struct MODS_TZ_PARAMS *p);
#endif
#ifdef CONFIG_OPTEE
#if IS_ENABLED(CONFIG_OPTEE)
/* OP-TEE TA call */
int esc_mods_invoke_optee_ta(struct mods_client *client,
struct MODS_OPTEE_PARAMS *p);

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
/* SPDX-FileCopyrightText: Copyright (c) 2008-2023, NVIDIA CORPORATION. All rights reserved. */
/* SPDX-FileCopyrightText: Copyright (c) 2008-2024, NVIDIA CORPORATION. All rights reserved. */
#include "mods_internal.h"
@@ -8,11 +8,10 @@
#include <linux/interrupt.h>
#include <linux/pci_regs.h>
#if defined(MODS_HAS_TEGRA) && defined(CONFIG_OF) && defined(CONFIG_OF_IRQ)
#include <linux/of.h>
#include <linux/of_irq.h>
#include <linux/io.h>
#include <linux/platform_device.h>
#include <linux/of_device.h>
#include <linux/of_platform.h>
#include <linux/gpio.h>
#include <linux/of_gpio.h>
#endif

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
/* SPDX-FileCopyrightText: Copyright (c) 2019-2023, NVIDIA CORPORATION. All rights reserved. */
/* SPDX-FileCopyrightText: Copyright (c) 2019-2024, NVIDIA CORPORATION. All rights reserved. */
#include <linux/kernel.h>
#include <linux/device.h>
@@ -12,8 +12,8 @@
#include <linux/version.h>
#include <linux/dma-buf.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/acpi.h>
#include "mods_internal.h"

View File

@@ -17,7 +17,6 @@
#include <linux/printk.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/version.h>
#include <linux/wait.h>
#include <uapi/misc/nvscic2c-pcie-ioctl.h>
@@ -345,7 +344,7 @@ endpoint_fops_mmap(struct file *filp, struct vm_area_struct *vma)
}
vma->vm_pgoff = 0;
#if defined(CONFIG_TEGRA_SYSTEM_TYPE_ACK) && (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
#if defined(NV_VM_AREA_STRUCT_HAS_CONST_VM_FLAGS) /* Linux v6.3 */
vm_flags_set(vma, VM_DONTCOPY);
#else
vma->vm_flags |= (VM_DONTCOPY); // fork() not supported.

View File

@@ -1,6 +1,8 @@
// SPDX-License-Identifier: GPL-2.0-only
// Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#include <nvidia/conftest.h>
#define pr_fmt(fmt) "nvscic2c-pcie: epc: " fmt
#include <linux/aer.h>
@@ -290,7 +292,9 @@ deinit:
pci_release_region(pdev, 0);
pci_clear_master(pdev);
#if defined(NV_PCI_DISABLE_PCIE_ERROR_REPORTING_PRESENT) /* Linux 6.5 */
pci_disable_pcie_error_reporting(pdev);
#endif
pci_disable_device(pdev);
dt_release(&drv_ctx->drv_param);
@@ -350,7 +354,7 @@ nvscic2c_pcie_epc_probe(struct pci_dev *pdev,
ret = pcim_enable_device(pdev);
if (ret)
goto err_enable_device;
#if !defined(NV_DROP_PCIE_ERROR_REPORTING)
#if defined(NV_PCI_ENABLE_PCIE_ERROR_REPORTING_PRESENT) /* Linux 6.5 */
pci_enable_pcie_error_reporting(pdev);
#endif
pci_set_master(pdev);

View File

@@ -733,7 +733,11 @@ static const struct pci_epc_event_ops nvscic2c_event_ops = {
};
static int
#if defined(NV_PCI_EPF_DRIVER_STRUCT_PROBE_HAS_ID_ARG) /* Linux 6.4 */
nvscic2c_pcie_epf_probe(struct pci_epf *epf, const struct pci_epf_device_id *id)
#else
nvscic2c_pcie_epf_probe(struct pci_epf *epf)
#endif
{
int ret = 0;
char *name = NULL;

View File

@@ -3,6 +3,8 @@
#define pr_fmt(fmt) "nvscic2c-pcie: stream-ext: " fmt
#include <nvidia/conftest.h>
#include <linux/anon_inodes.h>
#include <linux/device.h>
#include <linux/errno.h>
@@ -15,7 +17,6 @@
#include <linux/slab.h>
#include <linux/syscalls.h>
#include <linux/tegra-pcie-edma.h>
#include <linux/version.h>
#include <uapi/misc/nvscic2c-pcie-ioctl.h>
@@ -294,7 +295,7 @@ fops_mmap(struct file *filep, struct vm_area_struct *vma)
memaddr = stream_obj->aper;
vma->vm_pgoff = 0;
#if defined(CONFIG_TEGRA_SYSTEM_TYPE_ACK) && (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
#if defined(NV_VM_AREA_STRUCT_HAS_CONST_VM_FLAGS) /* Linux v6.3 */
vm_flags_set(vma, VM_DONTCOPY);
#else
vma->vm_flags |= (VM_DONTCOPY);

View File

@@ -19,7 +19,7 @@ make -C /lib/modules/`uname -r`/build M=${PWD} modules
sudo make -C /lib/modules/`uname -r`/build M=${PWD} modules_install
sudo depmod -a
nvsciipc.ko will be installed in /lib/modules/`uname -r`/extra/nvsciipc.ko
nvsciipc.ko will be installed in /lib/modules/`uname -r`/updates/nvsciipc.ko
[NOTE] If kernel module installation is failed by missing signing key, follow steps below

View File

@@ -1,13 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* SPDX-FileCopyrightText: Copyright (c) 2019-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*
* NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
* property and proprietary rights in and to this material, related
* documentation and any modifications thereto. Any use, reproduction,
* disclosure or distribution of this material and related documentation
* without an express license agreement from NVIDIA CORPORATION or
* its affiliates is strictly prohibited.
*/
/*

View File

@@ -5,6 +5,8 @@
* Copyright (C) 2021-2023 NVIDIA Corporation. All rights reserved.
*/
#include <nvidia/conftest.h>
#include <linux/aer.h>
#include <linux/delay.h>
#include <linux/crc32.h>
@@ -170,7 +172,7 @@ static int ep_test_dma_probe(struct pci_dev *pdev,
return ret;
}
#if !defined(NV_DROP_PCIE_ERROR_REPORTING)
#if defined(NV_PCI_ENABLE_PCIE_ERROR_REPORTING_PRESENT) /* Linux 6.5 */
pci_enable_pcie_error_reporting(pdev);
#endif

Some files were not shown because too many files have changed in this diff Show More