Compare commits

...

46 Commits

Author SHA1 Message Date
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
86 changed files with 1034 additions and 1376 deletions

View File

@@ -5,11 +5,13 @@ LINUXINCLUDE += -I$(srctree.nvconftest)
LINUXINCLUDE += -I$(srctree.nvidia-oot)/include
subdir-ccflags-y += -Werror
subdir-ccflags-y += -Wmissing-prototypes
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)
LINUX_VERSION_6_7 := $(shell expr 6 \* 256 + 7)
# 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.
@@ -47,18 +49,6 @@ 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

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

@@ -492,7 +492,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) {

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>
@@ -1747,7 +1749,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

@@ -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

@@ -10,7 +10,6 @@
#include <linux/of_device.h>
#include <linux/pm_runtime.h>
#include <linux/reset.h>
#include <linux/version.h>
#include <soc/tegra/common.h>
@@ -272,7 +271,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>
@@ -1122,7 +1124,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 +1871,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 +1899,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

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -1718,8 +1718,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

@@ -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);
}

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

@@ -5,6 +5,8 @@
* 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>
@@ -15,7 +17,6 @@
#include <linux/of.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,5 @@
// 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-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
/*
* nv_hawk_owl.c.c - ar0234 sensor driver
*/
@@ -15,6 +15,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>

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

@@ -30,7 +30,6 @@
#include <media/cdi-mgr.h>
#include <linux/gpio/consumer.h>
#include <linux/semaphore.h>
#include <linux/version.h>
#include <asm/barrier.h>
@@ -1488,10 +1487,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 +1651,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-2023, 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)

View File

@@ -18,7 +18,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>
@@ -957,10 +956,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-2023, 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)

View File

@@ -1,5 +1,7 @@
// 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 <linux/uaccess.h>
#include <linux/module.h>
@@ -13,7 +15,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 +210,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 +226,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));

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

@@ -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

View File

@@ -2477,12 +2477,14 @@ static int ether_mdio_read(struct mii_bus *bus, int phyaddr, int phyreg)
(unsigned int)phyreg);
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
#if defined(NV_MII_BUS_STRUCT_HAS_WRITE_C45) /* Linux v6.3 */
static int ether_mdio_write_c45(struct mii_bus *bus, int phyaddr, int devad, int regnum, u16 val)
{
return ether_mdio_write(bus, phyaddr, ether_mdio_c45_addr(devad, regnum), val);
}
#endif
#if defined(NV_MII_BUS_STRUCT_HAS_READ_C45) /* Linux v6.3 */
static int ether_mdio_read_c45(struct mii_bus *bus, int phyaddr, int devad, int regnum)
{
return ether_mdio_read(bus, phyaddr, ether_mdio_c45_addr(devad, regnum));
@@ -2521,8 +2523,10 @@ static int ether_mdio_register(struct ether_priv_data *pdata)
new_bus->name = "nvethernet_mdio_bus";
new_bus->read = ether_mdio_read;
new_bus->write = ether_mdio_write;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
#if defined(NV_MII_BUS_STRUCT_HAS_READ_C45) /* Linux v6.3 */
new_bus->read_c45 = ether_mdio_read_c45;
#endif
#if defined(NV_MII_BUS_STRUCT_HAS_WRITE_C45) /* Linux v6.3 */
new_bus->write_c45 = ether_mdio_write_c45;
#endif
ret = snprintf(new_bus->id, MII_BUS_ID_SIZE, "%s", dev_name(dev));

View File

@@ -4,6 +4,8 @@
#ifndef ETHER_LINUX_H
#define ETHER_LINUX_H
#include <nvidia/conftest.h>
#include <linux/platform/tegra/ptp-notifier.h>
#include <linux/ptp_clock_kernel.h>
#include <linux/pinctrl/consumer.h>
@@ -37,11 +39,11 @@
#include <soc/tegra/virt/hv-ivc.h>
#include <soc/tegra/fuse.h>
#if IS_ENABLED(CONFIG_PAGE_POOL)
#if defined(NV_SPLIT_PAGE_POOL_HEADER)
#if defined(NV_NET_PAGE_POOL_H_PRESENT)
#include <net/page_pool.h>
#else
#include <net/page_pool/types.h>
#include <net/page_pool/helpers.h>
#else
#include <net/page_pool.h>
#endif
#define ETHER_PAGE_POOL
#endif

View File

@@ -749,7 +749,7 @@ static int tvnet_host_probe(struct pci_dev *pdev,
goto free_netdev;
}
#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

View File

@@ -2113,7 +2113,7 @@ static u32 rtl8168_mdio_real_read_phy_ocp(struct rtl8168_private *tp,
return mdio_real_direct_read_phy_ocp(tp, ocp_addr);
}
u32 mdio_real_read(struct rtl8168_private *tp,
static u32 mdio_real_read(struct rtl8168_private *tp,
u32 RegAddr)
{
int i, value = 0;

View File

@@ -93,7 +93,7 @@ void rtl8168_eeprom_cleanup(struct rtl8168_private *tp)
rtl8168_lower_clock(tp, &x);
}
int rtl8168_eeprom_cmd_done(struct rtl8168_private *tp)
static int rtl8168_eeprom_cmd_done(struct rtl8168_private *tp)
{
u8 x;
int i;

View File

@@ -1,907 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*/
#undef DEBUG
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/version.h>
#include <linux/netdevice.h>
#include <linux/of.h>
#include <linux/of_net.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
#include <linux/serial.h>
#include <linux/serial_core.h>
#include <linux/platform_device.h>
#include <linux/io.h>
#include <soc/tegra/fuse.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <linux/ethtool.h>
#include <linux/if.h>
#include <linux/slab.h>
#define DRV_NAME "tegra_hv_net"
#define DRV_VERSION "0.1"
#include <soc/tegra/virt/syscalls.h>
#include <soc/tegra/virt/hv-ivc.h>
/* frame format is
* 0000: <flags>
* 0004: data
*
* data frame
* 0000: [16-bit frame size][13-bit pad][Last-bit][First-bit][F_CNTRL=0]
* 0004: [packet-size 32 bit]
* 0008: data
*
* control frame
* 0000: <flags> (F_CNTRL == 1) F_CNTRL_CMD(x)
* 0004: control frame data (deduced from F_CNTRL_CMD)
*/
/* data header size */
#define HDR_SIZE 8
#define F_CNTRL (1 << 0) /* control frame (0 = data frame) */
#define F_CNTRL_CMD(x) ((u32)((x) & 0xff) << 24) /* control frame command */
#define F_CNTRL_CMD_STATUS F_CNTRL_CMD(0) /* link status cmd */
#define F_STATUS_UP (1 << 1) /* link status is up */
#define F_STATUS_PAUSE (1 << 2) /* link status is pause */
#define F_STATUS_PENDING (1 << 23) /* pending link status update */
#define F_DATA_FIRST (1 << 1) /* first chunk of a frame */
#define F_DATA_LAST (1 << 2) /* last chunk of a frame */
#define F_DATA_FSIZE_SHIFT 16
#define F_DATA_FSIZE_MASK (~0 << F_DATA_FSIZE_SHIFT)
#define F_DATA_FSIZE(x) (((u32)(x) << F_DATA_FSIZE_SHIFT) & F_DATA_FSIZE_MASK)
/* jumbo frame limit */
#define MAX_MTU 9000
#define MIN_MTU 14
#define DEFAULT_HIGH_WATERMARK_MULT 50
#define DEFAULT_LOW_WATERMARK_MULT 25
#define DEFAULT_MAX_TX_DELAY_MSECS 10
enum drop_kind {
dk_none,
/* tx */
dk_linearize,
dk_full,
dk_wq,
dk_write,
/* rx */
dk_frame,
dk_packet,
dk_unexpected,
dk_alloc,
dk_overflow,
};
struct tegra_hv_net_stats {
struct u64_stats_sync tx_syncp;
struct u64_stats_sync rx_syncp;
u64 tx_bytes;
u64 tx_packets;
u64 tx_drops;
u64 rx_bytes;
u64 rx_packets;
u64 rx_drops;
/* internal tx stats */
u64 tx_linearize_fail;
u64 tx_queue_full;
u64 tx_wq_fail;
u64 tx_ivc_write_fail;
/* internal rx stats */
u64 rx_bad_frame;
u64 rx_bad_packet;
u64 rx_unexpected_packet;
u64 rx_alloc_fail;
u64 rx_overflow;
};
struct tegra_hv_net {
struct platform_device *pdev;
struct net_device *ndev;
struct tegra_hv_ivc_cookie *ivck;
int mac_address;
struct napi_struct napi;
struct tegra_hv_net_stats __percpu *stats;
struct sk_buff *rx_skb;
struct sk_buff_head tx_q;
struct work_struct xmit_work;
struct workqueue_struct *xmit_wq;
wait_queue_head_t wq;
unsigned int high_watermark; /* mult * framesize */
unsigned int low_watermark;
unsigned int max_tx_delay;
};
static int tegra_hv_net_open(struct net_device *ndev)
{
struct tegra_hv_net *hvn = netdev_priv(ndev);
napi_enable(&hvn->napi);
netif_start_queue(ndev);
/*
* check if there are already packets in our queue,
* and if so, we need to schedule a call to handle them
*/
if (tegra_hv_ivc_can_read(hvn->ivck))
napi_schedule(&hvn->napi);
return 0;
}
static irqreturn_t tegra_hv_net_interrupt(int irq, void *data)
{
struct net_device *ndev = data;
struct tegra_hv_net *hvn = netdev_priv(ndev);
/* until this function returns 0, the channel is unusable */
if (tegra_hv_ivc_channel_notified(hvn->ivck) != 0)
return IRQ_HANDLED;
if (tegra_hv_ivc_can_write(hvn->ivck))
wake_up_interruptible_all(&hvn->wq);
if (tegra_hv_ivc_can_read(hvn->ivck))
napi_schedule(&hvn->napi);
return IRQ_HANDLED;
}
static void *tegra_hv_net_xmit_get_buffer(struct tegra_hv_net *hvn)
{
void *p;
int ret;
/*
* grabbing a frame can fail for the following reasons:
* 1. the channel is full / peer is uncooperative
* 2. the channel is under reset / peer has restarted
*/
p = tegra_hv_ivc_write_get_next_frame(hvn->ivck);
if (IS_ERR(p)) {
ret = wait_event_interruptible_timeout(hvn->wq,
!IS_ERR(p = tegra_hv_ivc_write_get_next_frame(
hvn->ivck)),
msecs_to_jiffies(hvn->max_tx_delay));
if (ret <= 0) {
net_warn_ratelimited(
"%s: timed out after %u ms\n",
hvn->ndev->name,
hvn->max_tx_delay);
}
}
return p;
}
static void tegra_hv_net_xmit_work(struct work_struct *work)
{
struct tegra_hv_net *hvn =
container_of(work, struct tegra_hv_net, xmit_work);
struct tegra_hv_net_stats *stats = raw_cpu_ptr(hvn->stats);
struct net_device *ndev = hvn->ndev;
struct sk_buff *skb;
int ret, max_frame, count, first, last, orig_len;
u32 *p, p0, p1;
enum drop_kind dk;
max_frame = hvn->ivck->frame_size - HDR_SIZE;
dk = dk_none;
while ((skb = skb_dequeue(&hvn->tx_q)) != NULL) {
/* start the queue if it is short again */
if (netif_queue_stopped(ndev) &&
skb_queue_len(&hvn->tx_q) < hvn->low_watermark)
netif_start_queue(ndev);
ret = skb_linearize(skb);
if (ret != 0) {
netdev_err(hvn->ndev,
"%s: skb_linearize error=%d\n",
__func__, ret);
dk = dk_linearize;
goto drop;
}
/* print_hex_dump(KERN_INFO, "tx-", DUMP_PREFIX_OFFSET,
* 16, 1, skb->data, skb->len, true); */
/* copy the fragments */
orig_len = skb->len;
first = 1;
while (skb->len > 0) {
count = skb->len;
if (count > max_frame)
count = max_frame;
/* wait up to the maximum send timeout */
p = tegra_hv_net_xmit_get_buffer(hvn);
if (IS_ERR(p)) {
dk = dk_wq;
goto drop;
}
last = skb->len == count;
p0 = F_DATA_FSIZE(count);
if (first)
p0 |= F_DATA_FIRST;
if (last)
p0 |= F_DATA_LAST;
p1 = orig_len;
netdev_dbg(ndev, "F: %c%c F%d P%d [%08x %08x]\n",
first ? 'F' : '.',
last ? 'L' : '.',
count, orig_len, p[0], p[1]);
first = 0;
p[0] = p0;
p[1] = p1;
skb_copy_from_linear_data(skb, &p[2], count);
/* advance the tx queue */
(void)tegra_hv_ivc_write_advance(hvn->ivck);
skb_pull(skb, count);
}
/* all OK */
dk = dk_none;
drop:
dev_kfree_skb(skb);
u64_stats_update_begin(&stats->tx_syncp);
if (dk == dk_none) {
stats->tx_packets++;
stats->tx_bytes += orig_len;
} else {
stats->tx_drops++;
switch (dk) {
default:
/* never happens but gcc sometimes whines */
break;
case dk_linearize:
stats->tx_linearize_fail++;
break;
case dk_full:
stats->tx_queue_full++;
break;
case dk_wq:
stats->tx_wq_fail++;
break;
case dk_write:
stats->tx_ivc_write_fail++;
break;
}
}
u64_stats_update_end(&stats->tx_syncp);
}
}
/* xmit is dummy, we just add the skb to the tx_q and queue work */
static netdev_tx_t tegra_hv_net_xmit(struct sk_buff *skb,
struct net_device *ndev)
{
struct tegra_hv_net *hvn = netdev_priv(ndev);
skb_orphan(skb);
nf_reset_ct(skb);
skb_queue_tail(&hvn->tx_q, skb);
queue_work_on(WORK_CPU_UNBOUND, hvn->xmit_wq, &hvn->xmit_work);
/* stop the queue if it gets too long */
if (!netif_queue_stopped(ndev) &&
skb_queue_len(&hvn->tx_q) >= hvn->high_watermark)
netif_stop_queue(ndev);
else if (netif_queue_stopped(ndev) &&
skb_queue_len(&hvn->tx_q) < hvn->low_watermark)
netif_start_queue(ndev);
return NETDEV_TX_OK;
}
static int
tegra_hv_net_stop(struct net_device *ndev)
{
struct tegra_hv_net *hvn = netdev_priv(ndev);
netif_stop_queue(ndev);
napi_disable(&hvn->napi);
return 0;
}
static int tegra_hv_net_change_mtu(struct net_device *ndev, int new_mtu)
{
if (new_mtu < MIN_MTU || new_mtu > MAX_MTU) {
netdev_err(ndev, "invalid MTU, max MTU is: %d\n", MAX_MTU);
return -EINVAL;
}
if (ndev->mtu == new_mtu)
return 0;
/* we can really handle any MTU size */
ndev->mtu = new_mtu;
return 0;
}
static void tegra_hv_net_set_rx_mode(struct net_device *ndev)
{
/* we don't do any kind of filtering */
}
static void tegra_hv_net_tx_timeout(struct net_device *ndev, unsigned int txqueue)
{
netdev_err(ndev, "%s\n", __func__);
}
void
tegra_hv_net_get_stats64(struct net_device *ndev,
struct rtnl_link_stats64 *tot)
{
struct tegra_hv_net *hvn = netdev_priv(ndev);
struct tegra_hv_net_stats *stats;
u64 tx_packets, tx_bytes, tx_drops, rx_packets, rx_bytes, rx_drops;
unsigned int start;
int cpu;
for_each_possible_cpu(cpu) {
stats = per_cpu_ptr(hvn->stats, cpu);
do {
start = u64_stats_fetch_begin_irq(&stats->tx_syncp);
tx_packets = stats->tx_packets;
tx_bytes = stats->tx_bytes;
tx_drops = stats->tx_drops;
} while (u64_stats_fetch_retry_irq(&stats->tx_syncp, start));
do {
start = u64_stats_fetch_begin_irq(&stats->rx_syncp);
rx_packets = stats->rx_packets;
rx_bytes = stats->rx_bytes;
rx_drops = stats->rx_drops;
} while (u64_stats_fetch_retry_irq(&stats->rx_syncp, start));
tot->tx_packets += tx_packets;
tot->tx_bytes += tx_bytes;
tot->tx_dropped += tx_drops;
tot->rx_packets += rx_packets;
tot->rx_bytes += rx_bytes;
tot->rx_dropped += rx_drops;
}
}
static int tegra_hv_net_set_mac_address(struct net_device *dev, void *p)
{
return 0;
}
static const struct net_device_ops tegra_hv_netdev_ops = {
.ndo_open = tegra_hv_net_open,
.ndo_start_xmit = tegra_hv_net_xmit,
.ndo_stop = tegra_hv_net_stop,
.ndo_change_mtu = tegra_hv_net_change_mtu,
.ndo_set_rx_mode = tegra_hv_net_set_rx_mode,
.ndo_tx_timeout = tegra_hv_net_tx_timeout,
.ndo_get_stats64 = tegra_hv_net_get_stats64,
.ndo_set_mac_address = tegra_hv_net_set_mac_address,
};
static void tegra_hv_net_ethtool_get_drvinfo(struct net_device *ndev,
struct ethtool_drvinfo *info)
{
struct tegra_hv_net *hvn = netdev_priv(ndev);
strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
strlcpy(info->version, DRV_VERSION, sizeof(info->version));
strlcpy(info->bus_info, dev_name(&hvn->pdev->dev),
sizeof(info->bus_info));
}
static const struct ethtool_ops tegra_hv_ethtool_ops = {
.get_drvinfo = tegra_hv_net_ethtool_get_drvinfo,
.get_link = ethtool_op_get_link,
};
static void tegra_hv_net_tx_complete(struct tegra_hv_net *hvn)
{
struct net_device *ndev = hvn->ndev;
/* wake queue if no more tx buffers */
if (skb_queue_len(&hvn->tx_q) == 0)
netif_wake_queue(ndev);
}
static int tegra_hv_net_rx(struct tegra_hv_net *hvn, int limit)
{
struct tegra_hv_net_stats *stats = this_cpu_ptr(hvn->stats);
struct net_device *ndev = hvn->ndev;
struct sk_buff *skb;
int nr, frame_size, max_frame, count, first, last;
u32 *p, p0;
enum drop_kind dk;
max_frame = hvn->ivck->frame_size - HDR_SIZE;
nr = 0;
dk = dk_none;
while (nr < limit) {
/*
* grabbing a frame can fail for the following reasons:
* 1. the channel is empty / peer is uncooperative
* 2. the channel is under reset / peer has restarted
*/
p = tegra_hv_ivc_read_get_next_frame(hvn->ivck);
if (IS_ERR(p))
break;
nr++;
p0 = p[0];
first = !!(p0 & F_DATA_FIRST);
last = !!(p0 & F_DATA_LAST);
frame_size = (p0 & F_DATA_FSIZE_MASK) >> F_DATA_FSIZE_SHIFT;
count = p[1];
netdev_dbg(ndev, "F: %c%c F%d P%d [%08x %08x]\n",
first ? 'F' : '.',
last ? 'L' : '.',
frame_size, count, p[0], p[1]);
if (frame_size > max_frame) {
netdev_err(ndev, "Bad fragment size %d\n", frame_size);
dk = dk_frame;
goto drop;
}
/* verify that packet is sane */
if (count < MIN_MTU || count > MAX_MTU + MIN_MTU) {
netdev_err(ndev, "Bad packet size %d\n", count);
dk = dk_packet;
goto drop;
}
/* receive state machine */
if (hvn->rx_skb == NULL) {
if (!first) {
netdev_err(ndev, "unexpected fragment\n");
dk = dk_unexpected;
goto drop;
}
hvn->rx_skb = netdev_alloc_skb(ndev, count);
if (hvn->rx_skb == NULL) {
netdev_err(ndev, "failed to allocate packet\n");
dk = dk_alloc;
goto drop;
}
}
/* verify that skb still can receive the data */
if (skb_tailroom(hvn->rx_skb) < frame_size) {
netdev_err(ndev, "skb overflow\n");
dev_kfree_skb(hvn->rx_skb);
hvn->rx_skb = NULL;
dk = dk_overflow;
goto drop;
}
/* append the data */
skb = hvn->rx_skb;
skb_copy_to_linear_data_offset(skb, skb->len, p + 2,
frame_size);
skb_put(skb, frame_size);
if (last) {
/* print_hex_dump(KERN_INFO, "rx-", DUMP_PREFIX_OFFSET,
* 16, 1, skb->data, skb->len, true); */
count = skb->len;
skb->protocol = eth_type_trans(skb, ndev);
skb->ip_summed = CHECKSUM_NONE;
netif_receive_skb(skb);
hvn->rx_skb = NULL;
}
dk = dk_none;
drop:
(void)tegra_hv_ivc_read_advance(hvn->ivck);
u64_stats_update_begin(&stats->rx_syncp);
if (dk == dk_none) {
if (last) {
stats->rx_packets++;
stats->rx_bytes += count;
}
} else {
stats->rx_drops++;
switch (dk) {
default:
/* never happens but gcc sometimes whines */
break;
case dk_frame:
stats->rx_bad_frame++;
break;
case dk_packet:
stats->rx_bad_packet++;
break;
case dk_unexpected:
stats->rx_unexpected_packet++;
break;
case dk_alloc:
stats->rx_alloc_fail++;
break;
case dk_overflow:
stats->rx_overflow++;
break;
}
}
u64_stats_update_end(&stats->rx_syncp);
}
return nr;
}
static int tegra_hv_net_poll(struct napi_struct *napi, int budget)
{
struct tegra_hv_net *hvn =
container_of(napi, struct tegra_hv_net, napi);
int work_done = 0;
tegra_hv_net_tx_complete(hvn);
work_done = tegra_hv_net_rx(hvn, budget);
if (work_done < budget) {
napi_complete(napi);
/*
* if an interrupt occurs after tegra_hv_net_rx() but before
* napi_complete(), we lose the call to napi_schedule().
*/
if (tegra_hv_ivc_can_read(hvn->ivck))
napi_reschedule(napi);
}
return work_done;
}
static int tegra_hv_net_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct device_node *dn, *hv_dn;
struct net_device *ndev = NULL;
struct tegra_hv_net *hvn = NULL;
int ret;
u32 id;
u32 highmark, lowmark, txdelay;
if (!is_tegra_hypervisor_mode()) {
dev_info(dev, "Hypervisor is not present\n");
return -ENODEV;
}
dn = dev->of_node;
if (dn == NULL) {
dev_err(dev, "No OF data\n");
return -EINVAL;
}
hv_dn = of_parse_phandle(dn, "ivc", 0);
if (hv_dn == NULL) {
dev_err(dev, "Failed to parse phandle of ivc prop\n");
return -EINVAL;
}
ret = of_property_read_u32_index(dn, "ivc", 1, &id);
if (ret != 0) {
dev_err(dev, "Failed to read IVC property ID\n");
goto out_of_put;
}
ret = of_property_read_u32(dn, "high-watermark-mult", &highmark);
if (ret != 0)
highmark = DEFAULT_HIGH_WATERMARK_MULT;
ret = of_property_read_u32(dn, "low-watermark-mult", &lowmark);
if (ret != 0)
lowmark = DEFAULT_LOW_WATERMARK_MULT;
if (highmark <= lowmark) {
dev_err(dev, "Bad watermark configuration (high <= low = %u < %u)\n",
highmark, lowmark);
goto out_of_put;
}
ret = of_property_read_u32(dn, "max-tx-delay-msecs", &txdelay);
if (ret != 0)
txdelay = DEFAULT_MAX_TX_DELAY_MSECS;
ndev = alloc_netdev(sizeof(*hvn), "hv%d", NET_NAME_UNKNOWN,
ether_setup);
if (ndev == NULL) {
dev_err(dev, "Failed to allocate netdev\n");
ret = -ENOMEM;
goto out_of_put;
}
hvn = netdev_priv(ndev);
hvn->stats = alloc_percpu(struct tegra_hv_net_stats);
if (hvn->stats == NULL) {
dev_err(dev, "Failed to allocate per-cpu stats\n");
ret = -ENOMEM;
goto out_free_ndev;
}
hvn->ivck = tegra_hv_ivc_reserve(hv_dn, id, NULL);
of_node_put(hv_dn);
hv_dn = NULL;
if (IS_ERR_OR_NULL(hvn->ivck)) {
dev_err(dev, "Failed to reserve IVC channel %d\n", id);
ret = PTR_ERR(hvn->ivck);
hvn->ivck = NULL;
goto out_free_stats;
}
hvn->high_watermark = highmark * hvn->ivck->nframes;
hvn->low_watermark = lowmark * hvn->ivck->nframes;
hvn->max_tx_delay = txdelay;
/* make sure the frame size is sufficient */
if (hvn->ivck->frame_size <= HDR_SIZE + 4) {
dev_err(dev, "frame size too small to support COMM\n");
ret = -EINVAL;
goto out_unreserve;
}
dev_info(dev, "Reserved IVC channel #%d - frame_size=%d\n",
id, hvn->ivck->frame_size);
SET_NETDEV_DEV(ndev, dev);
platform_set_drvdata(pdev, ndev);
ether_setup(ndev);
ndev->max_mtu = MAX_MTU;
ndev->netdev_ops = &tegra_hv_netdev_ops;
ndev->ethtool_ops = &tegra_hv_ethtool_ops;
skb_queue_head_init(&hvn->tx_q);
INIT_WORK(&hvn->xmit_work, tegra_hv_net_xmit_work);
hvn->pdev = pdev;
hvn->ndev = ndev;
ndev->irq = hvn->ivck->irq;
init_waitqueue_head(&hvn->wq);
ndev->priv_flags |= IFF_UNICAST_FLT | IFF_LIVE_ADDR_CHANGE;
ndev->hw_features = 0; /* we're a really dumb device for now */
ndev->features |= ndev->hw_features;
/* get mac address from the DT */
hvn->mac_address = of_get_mac_address(dev->of_node, ndev->dev_addr);
if (IS_ERR(&hvn->mac_address)) {
if (of_property_read_bool(dev->of_node, "use-random-mac-addr"))
eth_hw_addr_random(ndev);
else {
#if KERNEL_VERSION(5, 16, 0) >= LINUX_VERSION_CODE
unsigned int gid;
dev_warn(dev, "No valid mac-address found, using fixed local address\n");
ndev->dev_addr[0] = 0x0a;
ndev->dev_addr[1] = 0x86;
ndev->dev_addr[2] = 0x4c;
ndev->dev_addr[3] = 0xf8;
ndev->dev_addr[4] = (uint8_t)id;
ret = hyp_read_gid(&gid);
if (ret != 0) {
dev_err(dev, "Failed to read guest id\n");
goto out_unreserve;
}
ndev->dev_addr[5] = (uint8_t)(gid);
#else
dev_err(dev, "No valid mac-address found\n");
#endif
}
} else {
/* Set the MAC address. */
ether_addr_copy(ndev->dev_addr, (const u8 *)&hvn->mac_address);
}
hvn->xmit_wq = alloc_workqueue("tgvnet-wq-%d",
WQ_UNBOUND | WQ_MEM_RECLAIM,
1, /* FIXME: from DT? */
pdev->id);
if (hvn->xmit_wq == NULL) {
dev_err(dev, "Failed to allocate workqueue\n");
ret = -ENOMEM;
goto out_unreserve;
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
netif_napi_add_weight(ndev, &hvn->napi, tegra_hv_net_poll, 64);
#else
netif_napi_add(ndev, &hvn->napi, tegra_hv_net_poll, 64);
#endif
ret = register_netdev(ndev);
if (ret) {
dev_err(dev, "Failed to register netdev\n");
goto out_free_wq;
}
/*
* start the channel reset process asynchronously. until the reset
* process completes, any attempt to use the ivc channel will return
* an error (e.g., all transmits will fail).
*/
tegra_hv_ivc_channel_reset(hvn->ivck);
/* the interrupt request must be the last action */
ret = devm_request_irq(dev, ndev->irq, tegra_hv_net_interrupt, 0,
dev_name(dev), ndev);
if (ret != 0) {
dev_err(dev, "Could not request irq #%d\n", ndev->irq);
goto out_unreg_netdev;
}
dev_info(dev, "ready\n");
return 0;
out_unreg_netdev:
unregister_netdev(ndev);
out_free_wq:
netif_napi_del(&hvn->napi);
destroy_workqueue(hvn->xmit_wq);
out_unreserve:
tegra_hv_ivc_unreserve(hvn->ivck);
out_free_stats:
free_percpu(hvn->stats);
out_free_ndev:
free_netdev(ndev);
out_of_put:
of_node_put(hv_dn);
return ret;
}
static int tegra_hv_net_remove(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct net_device *ndev = platform_get_drvdata(pdev);
struct tegra_hv_net *hvn = netdev_priv(ndev);
platform_set_drvdata(pdev, NULL);
devm_free_irq(dev, ndev->irq, dev);
unregister_netdev(ndev);
netif_napi_del(&hvn->napi);
destroy_workqueue(hvn->xmit_wq);
tegra_hv_ivc_unreserve(hvn->ivck);
free_percpu(hvn->stats);
free_netdev(ndev);
return 0;
}
#ifdef CONFIG_PM_SLEEP
static int tegra_hv_net_suspend(struct platform_device *pdev,
pm_message_t state)
{
struct net_device *ndev = platform_get_drvdata(pdev);
struct tegra_hv_net *hvn = netdev_priv(ndev);
/* If the netdev is not even running, no action */
if (!netif_running(ndev))
return 0;
/* As this device is going to suspend,
* link can't be considered up, although we are not resetting
* the IVC channel. Therefore mark the link detached
* This would stop tx from getting queued as well
*/
netif_device_detach(ndev);
ndev->netdev_ops->ndo_stop(ndev);
/* tegra_hv_net_stop uses netif_stop_queue to disable the queue.
* netif_stop_queue doesn't prevent xmit_transfer running on another
* cpu, so additionally we need netif_tx_disable
*/
netif_tx_disable(ndev);
/* Now no further job should be coming in, but
* there could be one queued or running already.
* Cancel or wait for such a job
*/
cancel_work_sync(&hvn->xmit_work);
/* Workqueue should not be running at this point,
* so disable irq
*/
disable_irq(ndev->irq);
return 0;
}
static int tegra_hv_net_resume(struct platform_device *pdev)
{
struct net_device *ndev = platform_get_drvdata(pdev);
struct tegra_hv_net *hvn = netdev_priv(ndev);
if (!netif_running(ndev))
return 0;
enable_irq(ndev->irq);
ndev->netdev_ops->ndo_open(ndev);
/* Would wake the queue and mark the link enabled */
netif_device_attach(ndev);
/* Start the queue blindly, in case the previous
* work was cancelled during suspend
* If there is no pending xmit,
* the workqueue will wake up then exit gracefully
*/
queue_work_on(WORK_CPU_UNBOUND, hvn->xmit_wq, &hvn->xmit_work);
return 0;
}
#endif
#ifdef CONFIG_OF
static struct of_device_id tegra_hv_net_match[] = {
{ .compatible = "nvidia,tegra-hv-net", },
{},
};
MODULE_DEVICE_TABLE(of, tegra_hv_net_match);
#endif /* CONFIG_OF */
static struct platform_driver tegra_hv_net_driver = {
.probe = tegra_hv_net_probe,
.remove = tegra_hv_net_remove,
#ifdef CONFIG_PM_SLEEP
.suspend = tegra_hv_net_suspend,
.resume = tegra_hv_net_resume,
#endif
.driver = {
.name = DRV_NAME,
.owner = THIS_MODULE,
.of_match_table = of_match_ptr(tegra_hv_net_match),
},
};
module_platform_driver(tegra_hv_net_driver);
MODULE_AUTHOR("Pantelis Antoniou <pantoniou@nvidia.com>");
MODULE_DESCRIPTION("Ethernet network device over Tegra Hypervisor IVC channel");
MODULE_LICENSE("GPL");

View File

@@ -18,6 +18,7 @@ EXTRA_CFLAGS += -Wno-implicit-fallthrough
EXTRA_CFLAGS += -Wno-unused-function
#EXTRA_CFLAGS += -Wno-unused
#EXTRA_CFLAGS += -Wno-uninitialized
EXTRA_CFLAGS += -Wno-missing-prototypes
GCC_VER_49 := $(shell echo `$(CC) -dumpversion | cut -f1-2 -d.` \>= 4.9 | bc )
ifeq ($(GCC_VER_49),1)

View File

@@ -1,6 +1,7 @@
/******************************************************************************
*
* Copyright(c) 2007 - 2017 Realtek Corporation.
* Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
@@ -88,8 +89,6 @@
#elif (DM_ODM_SUPPORT_TYPE == ODM_CE) && defined(DM_ODM_CE_MAC80211)
#define PHYDM_SNPRINTF snprintf
#elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
#undef pr_debug
#define pr_debug printk
#define RT_PRINTK(fmt, args...) pr_debug(fmt, ## args)
#define RT_DISP(dbgtype, dbgflag, printstr)
#define RT_TRACE(adapter, comp, drv_level, fmt, args...) \

View File

@@ -266,7 +266,11 @@ static const struct pci_epc_event_ops pci_epf_dma_test_event_ops = {
.core_deinit = pcie_dma_epf_core_deinit,
};
#if defined(NV_PCI_EPF_DRIVER_STRUCT_PROBE_HAS_ID_ARG) /* Linux 6.4 */
static int pcie_dma_epf_probe(struct pci_epf *epf, const struct pci_epf_device_id *id)
#else
static int pcie_dma_epf_probe(struct pci_epf *epf)
#endif
{
struct device *dev = &epf->dev;
struct pcie_epf_dma *epfnv;

View File

@@ -10,6 +10,7 @@ LINUXINCLUDE += -I$(srctree.nvidia-oot)/drivers/platform/tegra/aon/include
ccflags-y += -Werror
obj-m += tegra234-aon.o
obj-m += tegra-aon-ivc-echo.o
tegra234-aon-objs += \
tegra-aon-hsp.o \

View File

@@ -0,0 +1,124 @@
// SPDX-License-Identifier: GPL-2.0-only
// SPDX-FileCopyrightText: Copyright (c) 2017-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#include <linux/device.h>
#include <linux/mailbox_client.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/tegra-aon.h>
#define TX_BLOCK_PERIOD 100
#define IVC_FRAME_SIZE 64
struct tegra_aon_ivc_echo_data {
struct mbox_client cl;
struct mbox_chan *mbox;
char rx_data[IVC_FRAME_SIZE];
};
static ssize_t tegra_aon_ivc_echo_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct tegra_aon_ivc_echo_data *drvdata = dev_get_drvdata(dev);
memcpy(buf, drvdata->rx_data, IVC_FRAME_SIZE);
return IVC_FRAME_SIZE;
}
static ssize_t tegra_aon_ivc_echo_tx(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct tegra_aon_ivc_echo_data *drvdata = dev_get_drvdata(dev);
struct tegra_aon_mbox_msg msg;
int ret;
if (count > IVC_FRAME_SIZE) {
dev_err(dev, "Message is greater than the frame size %d\n",
IVC_FRAME_SIZE);
return -EINVAL;
}
msg.length = count;
msg.data = (void *)buf;
ret = mbox_send_message(drvdata->mbox, (void *)&msg);
if (ret < 0)
dev_err(dev, "mbox_send_message failed %d\n", ret);
return count;
}
static const DEVICE_ATTR(data_channel, S_IRUGO | S_IWUSR,
tegra_aon_ivc_echo_show, tegra_aon_ivc_echo_tx);
static void tegra_aon_ivc_echo_rx(struct mbox_client *cl, void *data)
{
struct tegra_aon_mbox_msg *msg = data;
struct tegra_aon_ivc_echo_data *drvdata = container_of(cl,
struct tegra_aon_ivc_echo_data,
cl);
memcpy(drvdata->rx_data, msg->data, IVC_FRAME_SIZE);
}
static int tegra_aon_ivc_echo_probe(struct platform_device *pdev)
{
int ret;
struct device *dev = &pdev->dev;
struct tegra_aon_ivc_echo_data *drvdata;
drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
if (!drvdata)
return -ENOMEM;
dev_set_drvdata(dev, drvdata);
drvdata->cl.dev = dev;
drvdata->cl.tx_block = true;
drvdata->cl.tx_tout = TX_BLOCK_PERIOD;
drvdata->cl.knows_txdone = false;
drvdata->cl.rx_callback = tegra_aon_ivc_echo_rx;
drvdata->mbox = mbox_request_channel(&drvdata->cl, 0);
if (IS_ERR(drvdata->mbox)) {
ret = PTR_ERR(drvdata->mbox);
if (ret != -EPROBE_DEFER)
dev_err(dev, "mbox_request_channel failed. Error %d\n",
ret);
return ret;
}
ret = device_create_file(dev, &dev_attr_data_channel);
if (ret) {
dev_err(dev, "Failed to create device file. Error %d\n", ret);
mbox_free_channel(drvdata->mbox);
return ret;
}
return 0;
}
static int tegra_aon_ivc_echo_remove(struct platform_device *pdev)
{
struct tegra_aon_ivc_echo_data *drvdata = dev_get_drvdata(&pdev->dev);
device_remove_file(&pdev->dev, &dev_attr_data_channel);
mbox_free_channel(drvdata->mbox);
return 0;
}
static const struct of_device_id tegra_aon_ivc_echo_match[] = {
{ .compatible = "nvidia,tegra186-aon-ivc-echo", },
{ },
};
MODULE_DEVICE_TABLE(of, tegra_aon_ivc_echo_match);
static struct platform_driver tegra_aon_ivc_echo_driver = {
.probe = tegra_aon_ivc_echo_probe,
.remove = tegra_aon_ivc_echo_remove,
.driver = {
.name = "tegra-aon-ivc-echo",
.of_match_table = tegra_aon_ivc_echo_match,
},
};
module_platform_driver(tegra_aon_ivc_echo_driver);
MODULE_LICENSE("GPL v2");

View File

@@ -1,12 +1,11 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*/
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#include <linux/errno.h>
#include <linux/debugfs.h>
#include <linux/uaccess.h>
#include <dce.h>
#include <dce-debug-perf.h>
#include <dce-log.h>
#include <dce-util-common.h>
#include <interface/dce-interface.h>

View File

@@ -131,7 +131,7 @@ static ssize_t dbg_dce_load_fw_write(struct file *file,
if (copy_from_user(buf, user_buf, buf_size))
return -EFAULT;
if (strtobool(buf, &bv) == 0) {
if (kstrtobool(buf, &bv) == 0) {
if (bv == true) {
ret = dbg_dce_load_fw(d);
if (ret)
@@ -176,7 +176,7 @@ static ssize_t dbg_dce_config_ast_write(struct file *file,
if (copy_from_user(buf, user_buf, buf_size))
return -EFAULT;
if (strtobool(buf, &bv) == 0) {
if (kstrtobool(buf, &bv) == 0) {
if (bv == true)
dbg_dce_config_ast(d);
}
@@ -219,7 +219,7 @@ static ssize_t dbg_dce_reset_dce_fops_write(struct file *file,
if (copy_from_user(buf, user_buf, buf_size))
return -EFAULT;
if (strtobool(buf, &bv) == 0) {
if (kstrtobool(buf, &bv) == 0) {
if (bv == true) {
ret = dbg_dce_reset_dce(d);
if (ret)
@@ -455,7 +455,7 @@ static ssize_t dbg_dce_boot_dce_fops_write(struct file *file,
if (copy_from_user(buf, user_buf, buf_size))
return -EFAULT;
if (strtobool(buf, &bv) == 0) {
if (kstrtobool(buf, &bv) == 0) {
if (bv == true) {
ret = dbg_dce_boot_dce(d);
if (ret)

View File

@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/**
* Copyright (c) 2014-2023, NVIDIA CORPORATION. All rights reserved.
*/
// SPDX-FileCopyrightText: Copyright (c) 2014-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#include <nvidia/conftest.h>
#include <linux/init.h>
#include <linux/module.h>
@@ -323,7 +323,7 @@ bool is_adsp_dram_addr(u64 addr)
return false;
}
int is_cluster_mem_addr(u64 addr)
static int is_cluster_mem_addr(u64 addr)
{
int clust_id;
struct nvadsp_drv_data *drv_data = platform_get_drvdata(priv.pdev);
@@ -769,7 +769,11 @@ static void *nvadsp_dma_alloc_and_map_at(struct platform_device *pdev,
/* Remap the contiguous physical addresses together */
ret = iommu_map(domain, iova + offset, pa, mp_size,
#if defined(NV_IOMMU_MAP_HAS_GFP_ARG)
IOMMU_READ | IOMMU_WRITE, GFP_KERNEL);
#else
IOMMU_READ | IOMMU_WRITE);
#endif
if (ret) {
dev_err(dev, "failed to map pa %llx va %llx size %lx\n",
pa, iova + offset, mp_size);

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2022-2023, NVIDIA CORPORATION. All rights reserved.
// SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#include <linux/init.h>
#include <linux/module.h>
@@ -19,6 +19,8 @@
#include <linux/of.h>
#include <linux/of_address.h>
#include "tegra_bootloader_debug.h"
static phys_addr_t tegra_bl_debug_data_start;
static phys_addr_t tegra_bl_debug_data_size;
static phys_addr_t tegra_bl_prof_start;

View File

@@ -0,0 +1,11 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* SPDX-FileCopyrightText: Copyright (C) 2023 NVIDIA CORPORATION. All rights reserved.
*/
#ifndef __TEGRA_BOOTLOADER_DEBUG_H
#define __TEGRA_BOOTLOADER_DEBUG_H
size_t tegra_bl_add_profiler_entry(const char *buf, size_t len);
#endif

View File

@@ -1,5 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
// Copyright (c) 2022-2023, NVIDIA CORPORATION. All rights reserved.
#include <nvidia/conftest.h>
#include <linux/module.h>
#include <linux/of.h>
@@ -316,7 +318,9 @@ static const struct pwm_ops pwm_tegra_tach_ops = {
.apply = tegra_pwm_apply,
#endif
.capture = pwm_tegra_tacho_capture,
#if defined(NV_PWM_OPS_STRUCT_HAS_OWNER) /* Linux 6.7 */
.owner = THIS_MODULE,
#endif
};
static void pwm_tegra_tach_read_platform_data(struct pwm_tegra_tach *ptt)

View File

@@ -194,6 +194,8 @@ static irqreturn_t nvvrs_rtc_irq_handler(int irq, void *data)
if (ret < 0)
dev_err(info->dev, "Failed to disable alarm: ret %d\n", ret);
rtc_update_irq(info->rtc_dev, 1, RTC_IRQF | RTC_AF);
return IRQ_HANDLED;
}

View File

@@ -1,5 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
// SPDX-License-Identifier: GPL-2.0-only
// SPDX-FileCopyrightText: Copyright (C) 2023 NVIDIA CORPORATION. All rights reserved.
#include <linux/clk.h>
#include <linux/reset.h>
@@ -22,6 +22,7 @@
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/spi/spi.h>
#include <linux/spi/spi-tegra124-slave.h>
#include <linux/clk/tegra.h>
#include <linux/version.h>
@@ -277,12 +278,6 @@ struct tegra_spi_controller_data {
int cs_gpio;
};
typedef int (*spi_callback)(void *client_data);
int tegra_spi_slave_register_callback(struct spi_device *spi,
spi_callback func_ready,
spi_callback func_isr,
void *client_data);
struct tegra_spi_data {
struct device *dev;
struct spi_controller *controller;

View File

@@ -4,5 +4,6 @@
ifeq ($(findstring ack_src,$(NV_BUILD_KERNEL_OPTIONS)),)
obj-m += pex9749-thermal.o
obj-m += tegra234-oc-event.o
obj-m += thermal-trip-event.o
endif
obj-m += max77851_thermal.o

View File

@@ -0,0 +1,257 @@
// SPDX-License-Identifier: GPL-2.0-only
// SPDX-FileCopyrightText: Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/thermal.h>
#include <linux/wait.h>
enum cdev_states {
CDEV_INACTIVE,
CDEV_ACTIVE,
CDEV_DESTROY,
};
struct therm_trip_event {
unsigned int cur_state;
unsigned int max_state;
unsigned int event_timeout_ms;
struct mutex cur_state_lock;
struct mutex event_timeout_lock;
struct thermal_cooling_device *cdev;
wait_queue_head_t waitq_head;
};
static int tte_cdev_get_max_state(struct thermal_cooling_device *tcd,
unsigned long *state)
{
struct therm_trip_event *tte = tcd->devdata;
*state = tte->max_state;
return 0;
}
static int tte_cdev_get_cur_state(struct thermal_cooling_device *tcd,
unsigned long *state)
{
struct therm_trip_event *tte = tcd->devdata;
*state = tte->cur_state;
return 0;
}
static int tte_cdev_set_cur_state(struct thermal_cooling_device *tcd,
unsigned long state)
{
struct therm_trip_event *tte = tcd->devdata;
struct device *dev = &tcd->device;
if (state > tte->max_state)
return -EINVAL;
if (state == tte->cur_state)
return 0;
dev_notice(dev, "%s cooling state: %u -> %lu\n", tcd->type,
tte->cur_state, state);
/*
* Although tcd->lock is already held in the thermal framework, a lock
* is added here to avoid a race condition between set_cur_state() and
* driver removal.
*/
mutex_lock(&tte->cur_state_lock);
tte->cur_state = state;
mutex_unlock(&tte->cur_state_lock);
if (tte->cur_state != CDEV_INACTIVE) {
if (wq_has_sleeper(&tte->waitq_head)) {
wake_up_interruptible_all(&tte->waitq_head);
dev_dbg(dev, "THERMAL_EVENT_TRIPPED!\n");
}
}
return 0;
}
static ssize_t thermal_trip_event_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct therm_trip_event *tte = dev_get_drvdata(dev);
return sprintf(buf, "%d\n", tte->cur_state);
}
static ssize_t thermal_trip_event_block_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
struct therm_trip_event *tte = dev_get_drvdata(dev);
unsigned int event_timeout_ms = tte->event_timeout_ms;
int ret;
if (event_timeout_ms > 0)
ret = wait_event_interruptible_timeout(
tte->waitq_head, tte->cur_state != CDEV_INACTIVE,
msecs_to_jiffies(event_timeout_ms));
else
ret = wait_event_interruptible(tte->waitq_head,
tte->cur_state != CDEV_INACTIVE);
/*
* -ERESTARTSYS is returned to avoid false alarm and to resume the call.
*/
if (ret < 0)
return ret;
return sprintf(buf, "%d\n", tte->cur_state);
}
static ssize_t thermal_trip_event_block_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
unsigned int val;
struct therm_trip_event *tte = dev_get_drvdata(dev);
if (kstrtouint(buf, 0, &val))
return -EINVAL;
mutex_lock(&tte->event_timeout_lock);
tte->event_timeout_ms = val;
mutex_unlock(&tte->event_timeout_lock);
return count;
}
static struct thermal_cooling_device_ops tte_cdev_ops = {
.get_max_state = tte_cdev_get_max_state,
.get_cur_state = tte_cdev_get_cur_state,
.set_cur_state = tte_cdev_set_cur_state,
};
static DEVICE_ATTR_RO(thermal_trip_event);
static DEVICE_ATTR_RW(thermal_trip_event_block);
static const struct attribute *tte_cdev_attr[] = {
&dev_attr_thermal_trip_event.attr,
&dev_attr_thermal_trip_event_block.attr,
NULL,
};
static int thermal_trip_event_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node;
struct therm_trip_event *tte;
const char *cdev_type;
int ret;
tte = devm_kzalloc(dev, sizeof(struct therm_trip_event), GFP_KERNEL);
if (!tte)
return -ENOMEM;
if (of_property_read_string(np, "cdev-type", &cdev_type) != 0) {
dev_err(dev, "invalid cdev-type property of %pOFn\n", np);
return -EINVAL;
}
tte->cur_state = CDEV_INACTIVE;
tte->max_state = CDEV_DESTROY;
mutex_init(&tte->cur_state_lock);
mutex_init(&tte->event_timeout_lock);
init_waitqueue_head(&tte->waitq_head);
dev_set_drvdata(dev, tte);
tte->cdev = thermal_of_cooling_device_register(np, cdev_type, tte,
&tte_cdev_ops);
if (IS_ERR(tte->cdev)) {
ret = PTR_ERR(tte->cdev);
goto destroy_lock;
}
ret = sysfs_create_files(&dev->kobj, tte_cdev_attr);
if (ret) {
dev_err(dev, "failed to create sysfs files\n");
goto free_cdev;
}
ret = sysfs_create_link(&tte->cdev->device.kobj, &dev->kobj,
"thermal_trip_event");
if (ret) {
dev_err(dev, "failed to create sysfs symlink\n");
goto free_sysfs_files;
}
dev_info(dev, "cooling device registered.\n");
return 0;
free_sysfs_files:
sysfs_remove_files(&dev->kobj, tte_cdev_attr);
free_cdev:
thermal_cooling_device_unregister(tte->cdev);
destroy_lock:
mutex_destroy(&tte->event_timeout_lock);
mutex_destroy(&tte->cur_state_lock);
return ret;
}
static int thermal_trip_event_remove(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct therm_trip_event *tte = dev_get_drvdata(dev);
struct thermal_cooling_device *cdev = tte->cdev;
/*
* There could be processes waiting for the event to happen while the
* driver is being removed. To have smooth removal, wake them up by
* updating the cur_state. The cooling state change here is not
* perceived by the thermal framework, but it's not a big deal as the
* cooling device is going to be destroyed soon.
*/
mutex_lock(&tte->cur_state_lock);
tte->cur_state = CDEV_DESTROY;
mutex_unlock(&tte->cur_state_lock);
if (wq_has_sleeper(&tte->waitq_head)) {
wake_up_interruptible_all(&tte->waitq_head);
dev_dbg(dev, "THERMAL_EVENT_DESTROYED!\n");
}
sysfs_remove_link(&cdev->device.kobj, "thermal_trip_event");
sysfs_remove_files(&dev->kobj, tte_cdev_attr);
thermal_cooling_device_unregister(cdev);
mutex_destroy(&tte->event_timeout_lock);
mutex_destroy(&tte->cur_state_lock);
return 0;
}
static const struct of_device_id thermal_trip_event_of_match[] = {
{
.compatible = "thermal-trip-event",
},
{},
};
MODULE_DEVICE_TABLE(of, thermal_trip_event_of_match);
static struct platform_driver thermal_trip_event_driver = {
.driver = {
.name = "thermal-trip-event",
.owner = THIS_MODULE,
.of_match_table = thermal_trip_event_of_match,
},
.probe = thermal_trip_event_probe,
.remove = thermal_trip_event_remove,
};
module_platform_driver(thermal_trip_event_driver);
MODULE_AUTHOR("Sreenivasulu Velpula <svelpula@nvidia.com>");
MODULE_AUTHOR("Yi-Wei Wang <yiweiw@nvidia.com>");
MODULE_DESCRIPTION("Thermal Trip Event Driver");
MODULE_LICENSE("GPL v2");

View File

@@ -734,7 +734,7 @@ void ch365_32s_test(void)
}
#endif
int wch_register_irq(void)
static int wch_register_irq(void)
{
struct wch_board *sb = NULL;
int status = 0;
@@ -784,7 +784,7 @@ int wch_register_irq(void)
return status;
}
void wch_iounmap(void)
static void wch_iounmap(void)
{
struct wch_board *sb = NULL;
int i;
@@ -802,7 +802,7 @@ void wch_iounmap(void)
}
}
void wch_release_irq(void)
static void wch_release_irq(void)
{
struct wch_board *sb = NULL;
int i;

View File

@@ -1,5 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2015-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
/*
* SPDX-FileCopyrightText: Copyright (C) 2015-2023 NVIDIA CORPORATION. All rights reserved.
*/
#include <linux/fs.h>
#include <linux/platform_device.h>
@@ -656,7 +658,6 @@ EXPORT_SYMBOL(tegra_camera_get_device_list_stats);
static int calculate_and_set_device_clock(struct tegra_camera_info *info,
struct tegra_camera_dev_info *cdev)
{
int ret = 0;
u64 active_pr = info->active_pixel_rate;
u64 phy_pr = info->phy_pixel_rate;
u32 overhead = cdev->overhead + 100;
@@ -675,6 +676,9 @@ static int calculate_and_set_device_clock(struct tegra_camera_info *info,
if (cdev->hw_type == HWTYPE_NONE)
return 0;
if (!cdev->ops->set_rate)
return -EOPNOTSUPP;
switch (cdev->hw_type) {
case HWTYPE_CSI:
if (info->sensor_type == SENSORTYPE_SLVSEC)
@@ -720,24 +724,7 @@ static int calculate_and_set_device_clock(struct tegra_camera_info *info,
if (info->num_active_streams == 0)
clk_rate = 0;
if (clk_rate != cdev->clk_rate)
cdev->clk_rate = clk_rate;
/*TODO OOT nvhost_module_set_rate, nvhost_module_get_rate
else
set_clk = false;
if (set_clk) {
ret = nvhost_module_set_rate(cdev->pdev, &cdev->hw_type,
cdev->clk_rate, 0, NVHOST_CLOCK);
if (ret)
return ret;
// save the actual rate set by nvhost
ret = nvhost_module_get_rate(cdev->pdev,
&cdev->actual_clk_rate, 0);
}*/
return ret;
return cdev->ops->set_rate(cdev, clk_rate);
}
int tegra_camera_update_clknbw(void *priv, bool stream_on)

View File

@@ -1,15 +1,14 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* ISP5 driver
*
* Copyright (c) 2017-2023, NVIDIA Corporation. All rights reserved.
* SPDX-FileCopyrightText: Copyright (C) 2017-2023 NVIDIA CORPORATION. All rights reserved.
*/
#include <asm/ioctls.h>
#include <linux/clk.h>
#include <linux/debugfs.h>
#include <linux/device.h>
#include <linux/dma-mapping.h>
#include <linux/dma-buf.h>
#include <linux/dma-mapping.h>
#include <linux/export.h>
#include <linux/fs.h>
#include <linux/module.h>
@@ -43,6 +42,7 @@
struct host_isp5 {
struct platform_device *pdev;
struct platform_device *isp_thi;
struct clk *clk;
};
static int isp5_alloc_syncpt(struct platform_device *pdev,
@@ -156,6 +156,18 @@ error:
return err;
}
static int isp5_set_rate(struct tegra_camera_dev_info *cdev_info, unsigned long rate)
{
struct nvhost_device_data *info = platform_get_drvdata(cdev_info->pdev);
struct host_isp5 *isp5 = info->private_data;
return clk_set_rate(isp5->clk, rate);
}
static struct tegra_camera_dev_ops isp5_cdev_ops = {
.set_rate = isp5_set_rate,
};
int isp5_priv_late_probe(struct platform_device *pdev)
{
struct tegra_camera_dev_info isp_info;
@@ -168,6 +180,8 @@ int isp5_priv_late_probe(struct platform_device *pdev)
isp_info.ppc = ISP_PPC;
isp_info.hw_type = HWTYPE_ISPA;
isp_info.pdev = pdev;
isp_info.ops = &isp5_cdev_ops;
err = tegra_camera_device_register(&isp_info, isp5);
if (err)
goto device_release;
@@ -186,6 +200,7 @@ device_release:
static int isp5_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct nvhost_device_data *pdata;
struct host_isp5 *isp5;
int err = 0;
@@ -197,6 +212,12 @@ static int isp5_probe(struct platform_device *pdev)
pdata = platform_get_drvdata(pdev);
isp5 = pdata->private_data;
isp5->clk = devm_clk_get(dev, NULL);
if (IS_ERR(isp5->clk)) {
dev_err(&pdev->dev, "failed to get clock\n");
return PTR_ERR(isp5->clk);
}
err = nvhost_client_device_get_resources(pdev);
if (err)
goto put_thi;

View File

@@ -1,8 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* NVCSI driver for T194
*
* Copyright (c) 2017-2022, NVIDIA Corporation. All rights reserved.
* SPDX-FileCopyrightText: Copyright (C) 2017-2023 NVIDIA CORPORATION. All rights reserved.
*/
#include "nvcsi-t194.h"
@@ -50,6 +48,7 @@ struct t194_nvcsi {
struct platform_device *pdev;
struct tegra_csi_device csi;
struct dentry *dir;
struct clk *clk;
};
struct nvhost_device_data t19_nvcsi_info = {
@@ -145,6 +144,18 @@ int t194_nvcsi_early_probe(struct platform_device *pdev)
return 0;
}
static int t194_nvcsi_set_rate(struct tegra_camera_dev_info *cdev_info, unsigned long rate)
{
struct nvhost_device_data *info = platform_get_drvdata(cdev_info->pdev);
struct t194_nvcsi *nvcsi = info->private_data;
return clk_set_rate(nvcsi->clk, rate);
}
static struct tegra_camera_dev_ops t194_nvcsi_cdev_ops = {
.set_rate = t194_nvcsi_set_rate,
};
int t194_nvcsi_late_probe(struct platform_device *pdev)
{
struct nvhost_device_data *pdata = platform_get_drvdata(pdev);
@@ -159,6 +170,8 @@ int t194_nvcsi_late_probe(struct platform_device *pdev)
csi_info.bus_width = CSI_BUS_WIDTH;
csi_info.lane_num = NUM_LANES;
csi_info.pg_clk_rate = PG_CLK_RATE;
csi_info.ops = &t194_nvcsi_cdev_ops;
err = tegra_camera_device_register(&csi_info, nvcsi);
if (err)
return err;
@@ -172,9 +185,10 @@ int t194_nvcsi_late_probe(struct platform_device *pdev)
static int t194_nvcsi_probe(struct platform_device *pdev)
{
int err;
struct device *dev = &pdev->dev;
struct nvhost_device_data *pdata;
struct t194_nvcsi *nvcsi;
int err;
err = t194_nvcsi_early_probe(pdev);
if (err)
@@ -184,6 +198,12 @@ static int t194_nvcsi_probe(struct platform_device *pdev)
nvcsi = pdata->private_data;
nvcsi->clk = devm_clk_get(dev, NULL);
if (IS_ERR(nvcsi->clk)) {
dev_err(&pdev->dev, "failed to get clock\n");
return PTR_ERR(nvcsi->clk);
}
err = nvhost_client_device_get_resources(pdev);
if (err)
return err;

View File

@@ -1,8 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
// SPDX-FileCopyrightText: Copyright (c) 2014-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
/*
* NVCSI driver
*
* Copyright (c) 2014-2022, NVIDIA Corporation. All rights reserved.
*/
#include <linux/device.h>
#include <linux/export.h>
@@ -28,6 +27,7 @@
//#include "camera/nvcsi/csi5_fops.h"
#include "deskew.h"
#include "nvcsi.h"
#define PG_CLK_RATE 102000000
/* width of interface between VI and CSI */

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-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#include <linux/kernel.h>
#include <linux/nvhost.h>
@@ -11,6 +9,7 @@
#include <linux/iommu.h>
#include <linux/dma-mapping.h>
#include "pva.h"
#include "nvpva_syncpt.h"
int nvpva_map_region(struct device *dev,
phys_addr_t start,

View File

@@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
// SPDX-FileCopyrightText: Copyright (c) 2017-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
/*
* Copyright (c) 2017-2023, NVIDIA CORPORATION. All rights reserved.
*
* PVA Command Queue Interface handling
*/
@@ -104,7 +103,7 @@ void pva_ccq_isr_handler(struct pva *pva, unsigned int queue_id)
wake_up(&pva->cmd_waitqueue[cmd_status_index]);
}
int pva_ccq_wait_event(struct pva *pva, unsigned int queue_id, int wait_time)
static int pva_ccq_wait_event(struct pva *pva, unsigned int queue_id, int wait_time)
{
int timeout = 1;
int err;

View File

@@ -1,7 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2021-2023, NVIDIA CORPORATION. All rights reserved.
*/
// SPDX-FileCopyrightText: Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#include <linux/kernel.h>
#include <linux/seq_file.h>
@@ -37,7 +35,7 @@ static const u8 max_desc_id[4] = {
[PVA_HW_GEN3] = NVPVA_TASK_MAX_DMA_DESCRIPTOR_ID_T26X
};
int
static int
pitch_linear_eq_offset(struct nvpva_dma_descriptor const *dma_desc,
s64 *frame_buf_offset,
const int64_t surf_bl_offset,

View File

@@ -1,11 +1,10 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2023, NVIDIA Corporation. All rights reserved.
*/
// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#include <linux/nvhost.h>
#include "pva_regs.h"
#include "pva.h"
#include "pva_sec_ec.h"
static u32 pva_get_sec_ec_addrs(u32 index)
{

View File

@@ -1,7 +1,5 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2021-2023, NVIDIA Corporation. All rights reserved.
*/
// SPDX-FileCopyrightText: Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#include <linux/kernel.h>
#include <linux/types.h>
@@ -21,7 +19,7 @@ struct pva_buff_s {
uint32_t size;
};
s32 read_buff(struct pva_buff_s *src_buf, void *dst, u32 size)
static s32 read_buff(struct pva_buff_s *src_buf, void *dst, u32 size)
{
u32 pos = src_buf->pos + size;

View File

@@ -1,8 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* VI5 driver
*
* Copyright (c) 2017-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-FileCopyrightText: Copyright (C) 2017-2023 NVIDIA CORPORATION. All rights reserved.
*/
#include <asm/ioctls.h>
@@ -52,6 +50,7 @@ struct host_vi5 {
struct platform_device *vi_thi;
struct vi vi_common;
struct icc_path *icc_write;
struct clk *clk;
/* Debugfs */
struct vi5_debug {
@@ -205,6 +204,18 @@ put_vi:
return err;
}
static int vi5_set_rate(struct tegra_camera_dev_info *cdev_info, unsigned long rate)
{
struct nvhost_device_data *info = platform_get_drvdata(cdev_info->pdev);
struct host_vi5 *vi5 = info->private_data;
return clk_set_rate(vi5->clk, rate);
}
static struct tegra_camera_dev_ops vi5_cdev_ops = {
.set_rate = vi5_set_rate,
};
int vi5_priv_late_probe(struct platform_device *pdev)
{
struct tegra_camera_dev_info vi_info;
@@ -217,6 +228,7 @@ int vi5_priv_late_probe(struct platform_device *pdev)
vi_info.hw_type = HWTYPE_VI;
vi_info.ppc = NUM_PPC;
vi_info.overhead = VI_OVERHEAD;
vi_info.ops = &vi5_cdev_ops;
err = tegra_camera_device_register(&vi_info, vi5);
if (err)
@@ -248,6 +260,12 @@ static int vi5_probe(struct platform_device *pdev)
pdata = platform_get_drvdata(pdev);
vi5 = pdata->private_data;
vi5->clk = devm_clk_get(dev, NULL);
if (IS_ERR(vi5->clk)) {
dev_err(&pdev->dev, "failed to get clock\n");
return PTR_ERR(vi5->clk);
}
vi5->icc_write = devm_of_icc_get(dev, "write");
if (IS_ERR(vi5->icc_write)) {
dev_err(dev, "failed to get icc write handle\n");

View File

@@ -452,8 +452,7 @@ int __nvmap_map(struct nvmap_handle *h, struct vm_area_struct *vma)
}
priv->handle = h;
#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_SHARED | VM_DONTEXPAND |
VM_DONTDUMP | VM_DONTCOPY |
(h->heap_pgalloc ? 0 : VM_PFNMAP));

View File

@@ -5,6 +5,8 @@
* Handle allocation and freeing routines for nvmap
*/
#include <nvidia/conftest.h>
#define pr_fmt(fmt) "%s: " fmt, __func__
#include <linux/err.h>
@@ -515,7 +517,11 @@ struct nvmap_handle_ref *nvmap_dup_handle_ro(struct nvmap_client *client,
return ERR_CAST(h->dmabuf_ro);
}
} else {
#if defined(NV_GET_FILE_RCU_HAS_DOUBLE_PTR_FILE_ARG) /* Linux 6.7 */
if (!get_file_rcu(&h->dmabuf_ro->file)) {
#else
if (!get_file_rcu(h->dmabuf_ro->file)) {
#endif
mutex_unlock(&h->lock);
remain = wait_event_interruptible_timeout(h->waitq,
!h->dmabuf_ro, (long)msecs_to_jiffies(100U));

View File

@@ -581,11 +581,15 @@ static unsigned long nvmap_page_pool_scan_objects(struct shrinker *shrinker,
SHRINK_STOP : (sc->nr_to_scan - remaining);
}
#if defined(NV_SHRINKER_ALLOC_PRESENT) /* Linux 6.7 */
static struct shrinker *nvmap_page_pool_shrinker;
#else
static struct shrinker nvmap_page_pool_shrinker = {
.count_objects = nvmap_page_pool_count_objects,
.scan_objects = nvmap_page_pool_scan_objects,
.seeks = 1,
};
#endif
static void shrink_page_pools(unsigned long *total_pages, unsigned long *available_pages)
{
@@ -771,10 +775,23 @@ int nvmap_page_pool_init(struct nvmap_device *dev)
NULL, "nvmap-bz");
if (IS_ERR(background_allocator))
goto fail;
#if defined(NV_SHRINKER_ALLOC_PRESENT) /* Linux 6.7 */
nvmap_page_pool_shrinker = shrinker_alloc(0, "nvmap_pp_shrinker");
if (!nvmap_page_pool_shrinker) {
goto fail;
}
nvmap_page_pool_shrinker->count_objects = nvmap_page_pool_count_objects;
nvmap_page_pool_shrinker->scan_objects = nvmap_page_pool_scan_objects;
nvmap_page_pool_shrinker->seeks = 1;
shrinker_register(nvmap_page_pool_shrinker);
#else
#if defined(NV_REGISTER_SHRINKER_HAS_FMT_ARG) /* Linux v6.0 */
register_shrinker(&nvmap_page_pool_shrinker, "nvmap_pp_shrinker");
#else
register_shrinker(&nvmap_page_pool_shrinker);
#endif
#endif
return 0;
@@ -793,7 +810,12 @@ int nvmap_page_pool_fini(struct nvmap_device *dev)
* registered
*/
if (!IS_ERR_OR_NULL(background_allocator)) {
#if defined(NV_SHRINKER_ALLOC_PRESENT) /* Linux 6.7 */
shrinker_free(nvmap_page_pool_shrinker);
nvmap_page_pool_shrinker = NULL;
#else
unregister_shrinker(&nvmap_page_pool_shrinker);
#endif
kthread_stop(background_allocator);
background_allocator = NULL;
}

View File

@@ -5,6 +5,8 @@
* mapping between nvmap_hnadle and sci_ipc entery
*/
#include <nvidia/conftest.h>
#define pr_fmt(fmt) "%s: " fmt, __func__
#include <linux/slab.h>
@@ -249,7 +251,11 @@ int nvmap_get_handle_from_sci_ipc_id(struct nvmap_client *client, u32 flags,
goto unlock;
}
} else {
#if defined(NV_GET_FILE_RCU_HAS_DOUBLE_PTR_FILE_ARG) /* Linux 6.7 */
if (!get_file_rcu(&h->dmabuf_ro->file)) {
#else
if (!get_file_rcu(h->dmabuf_ro->file)) {
#endif
mutex_unlock(&h->lock);
remain = wait_event_interruptible_timeout(h->waitq,
!h->dmabuf_ro, (long)msecs_to_jiffies(100U));

View File

@@ -1,13 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* SPDX-FileCopyrightText: Copyright (c) 2022-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.
*/
#include <nvidia/conftest.h>

View File

@@ -0,0 +1,17 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* SPDX-FileCopyrightText: Copyright (C) 2023 NVIDIA CORPORATION. All rights reserved.
*/
#ifndef __LINUX_SPI_TEGRA124_SLAVE_H
#define __LINUX_SPI_TEGRA124_SLAVE_H
#include <linux/spi/spi.h>
typedef int (*spi_callback)(void *client_data);
int tegra124_spi_slave_register_callback(struct spi_device *spi,
spi_callback func_ready,
spi_callback func_isr,
void *client_data);
#endif

View File

@@ -0,0 +1,11 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* SPDX-FileCopyrightText: Copyright (C) 2023 NVIDIA CORPORATION. All rights reserved.
*/
#ifndef __NV_HAWK_OWL_H
#define __NV_HAWK_OWL_H
int Hawk_Owl_Fsync_program(int fsync_type);
#endif

View File

@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2015-2022, NVIDIA CORPORATION. All rights reserved.
* SPDX-FileCopyrightText: Copyright (C) 2015-2023 NVIDIA CORPORATION. All rights reserved.
*/
#ifndef _TEGRA_CAMERA_PLATFORM_H_
@@ -38,6 +38,16 @@ enum tegra_camera_sensor_type {
SENSORTYPE_MAX,
};
struct tegra_camera_dev_info;
/**
* struct tegra_camera_dev_ops - camera device operations
* @set_rate: set the device clock rate
*/
struct tegra_camera_dev_ops {
int (*set_rate)(struct tegra_camera_dev_info *cdev_info, unsigned long rate);
};
/**
* struct tegra_camera_dev_info - camera devices information
* @priv: a unique identifier assigned during registration
@@ -45,8 +55,6 @@ enum tegra_camera_sensor_type {
* @bus_width: csi bus width for clock calculation
* @overhead: hw/ sw overhead considered while calculations
* @ppc: HW capability, pixels per clock
* @clk_rate: calculated clk rate for this node
* @actual_clk_rate: clk rate set by nvhost
* @bw: calculated bw for this node
* @use_max: populated by hw engine to decide it's clocking policy
* @memory_latency: latency allowed for memory freq scaling
@@ -57,6 +65,7 @@ enum tegra_camera_sensor_type {
* @bpp: bytes per pixel
* @stream_on: stream enabled on the channel
* @device_node: list node
* @ops: operation callbacks of the camera device
*/
struct tegra_camera_dev_info {
void *priv;
@@ -66,9 +75,7 @@ struct tegra_camera_dev_info {
u64 lane_speed;
u32 lane_num;
u32 ppc;
u64 clk_rate;
u64 pg_clk_rate;
unsigned long actual_clk_rate;
u64 bw;
bool use_max;
u32 memory_latency;
@@ -79,6 +86,7 @@ struct tegra_camera_dev_info {
u32 bpp;
bool stream_on;
struct list_head device_node;
const struct tegra_camera_dev_ops *ops;
};
int tegra_camera_update_isobw(void);

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.
*/
#ifndef __NVSCIIPC_IOCTL_H__

View File

@@ -1,13 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* SPDX-FileCopyrightText: Copyright (c) 2022-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.
*/
#ifndef __UAPI_TEGRA_IVC_DEV_H

View File

@@ -95,14 +95,17 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += blk_mq_destroy_queue
NV_CONFTEST_FUNCTION_COMPILE_TESTS += block_device_operations_open_has_gendisk_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += block_device_operations_release_has_no_mode_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += bus_type_struct_remove_has_int_return_type
NV_CONFTEST_FUNCTION_COMPILE_TESTS += bus_type_struct_uevent_has_const_dev_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += class_create_has_no_owner_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += class_struct_devnode_has_const_dev_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += define_semaphore_has_number_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += device_add_disk_has_int_return_type
NV_CONFTEST_FUNCTION_COMPILE_TESTS += devm_tegra_core_dev_init_opp_table_common
NV_CONFTEST_FUNCTION_COMPILE_TESTS += devm_thermal_of_zone_register
NV_CONFTEST_FUNCTION_COMPILE_TESTS += disk_check_media_change
NV_CONFTEST_FUNCTION_COMPILE_TESTS += dma_slave_config_struct_has_slave_id
NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_aperture_remove_framebuffers
NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_debugfs_remove_files_has_root_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_driver_struct_has_irq_enabled_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_fb_helper_alloc_info
NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_fb_helper_prepare_has_preferred_bpp_arg
@@ -112,22 +115,34 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_mode_config_struct_has_fb_base_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += drm_scdc_get_set_has_struct_drm_connector_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += ethtool_ops_get_set_coalesce_has_coal_and_extack_args
NV_CONFTEST_FUNCTION_COMPILE_TESTS += ethtool_ops_get_set_ringparam_has_ringparam_and_extack_args
NV_CONFTEST_FUNCTION_COMPILE_TESTS += get_file_rcu_has_double_ptr_file_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += get_user_pages
NV_CONFTEST_FUNCTION_COMPILE_TESTS += iio_dev_opaque_has_mlock
NV_CONFTEST_FUNCTION_COMPILE_TESTS += iommu_map_has_gfp_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += kthread_complete_and_exit
NV_CONFTEST_FUNCTION_COMPILE_TESTS += mii_bus_struct_has_read_c45
NV_CONFTEST_FUNCTION_COMPILE_TESTS += mii_bus_struct_has_write_c45
NV_CONFTEST_FUNCTION_COMPILE_TESTS += netif_set_tso_max_size
NV_CONFTEST_FUNCTION_COMPILE_TESTS += netif_napi_add_weight
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pde_data
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pwm_ops_struct_has_owner
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_disable_pcie_error_reporting
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_enable_pcie_error_reporting
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_epf_driver_struct_probe_has_id_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += register_shrinker_has_fmt_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += shrinker_alloc
NV_CONFTEST_FUNCTION_COMPILE_TESTS += snd_soc_card_jack_new_has_no_snd_soc_jack_pins
NV_CONFTEST_FUNCTION_COMPILE_TESTS += snd_soc_component_driver_struct_has_non_legacy_dai_naming
NV_CONFTEST_FUNCTION_COMPILE_TESTS += snd_soc_dai_link_struct_has_c2c_params_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += snd_soc_of_get_dai_name_has_index_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += snd_soc_rtd_to_codec
NV_CONFTEST_FUNCTION_COMPILE_TESTS += simple_util_dai_init
NV_CONFTEST_FUNCTION_COMPILE_TESTS += tc_taprio_qopt_offload_struct_has_cmd
NV_CONFTEST_FUNCTION_COMPILE_TESTS += tegra_dev_iommu_get_stream_id
NV_CONFTEST_FUNCTION_COMPILE_TESTS += tegra_ivc_struct_has_iosys_map
NV_CONFTEST_GENERIC_COMPILE_TESTS ?=
NV_CONFTEST_FUNCTION_COMPILE_TESTS += vm_area_struct_has_const_vm_flags
NV_CONFTEST_GENERIC_COMPILE_TESTS += is_export_symbol_present_drm_gem_prime_fd_to_handle
NV_CONFTEST_GENERIC_COMPILE_TESTS += is_export_symbol_present_drm_gem_prime_handle_to_fd
NV_CONFTEST_MACRO_COMPILE_TESTS ?=
NV_CONFTEST_SYMBOL_COMPILE_TESTS ?=
NV_CONFTEST_TYPE_COMPILE_TESTS += request_struct_has_completion_data_arg
@@ -155,7 +170,8 @@ NV_HEADER_PRESENCE_TESTS = \
generated/autoconf.h \
linux/kconfig.h \
linux/iosys-map.h \
net/gso.h
net/gso.h \
net/page_pool.h
# Filename to store the define for the header in $(1); this is only consumed by
# the rule below that concatenates all of these together.

View File

@@ -2448,6 +2448,23 @@ compile_test() {
compile_check_conftest "$CODE" "NV_PCI_DEV_HAS_ATS_ENABLED" "" "types"
;;
get_file_rcu_has_double_ptr_file_arg)
#
# Determine if the function 'get_file_rcu()' has pointer to pointer of file
# type argument or not.
#
# In Linux v6.7, commit 0ede61d8589cc2 ("file: convert to SLAB_TYPESAFE_BY_RCU")
# changed the argument of file handle to pointer type.
#
CODE="
#include <linux/fs.h>
struct file *conftest_get_file_rcu_has_double_ptr_file_arg(struct file __rcu *f) {
return get_file_rcu(&f);
}"
compile_check_conftest "$CODE" "NV_GET_FILE_RCU_HAS_DOUBLE_PTR_FILE_ARG" "" "types"
;;
get_user_pages)
#
# Conftest for get_user_pages()
@@ -6461,6 +6478,26 @@ compile_test() {
compile_check_conftest "$CODE" "NV_BUS_TYPE_STRUCT_REMOVE_HAS_INT_RETURN_TYPE" "" "types"
;;
bus_type_struct_uevent_has_const_dev_arg)
#
# Determine if the 'uevent' callback from the 'bus_type' structure
# has a const 'struct dev' argument.
#
# Commit 2a81ada32f0e ("driver core: make struct bus_type.uevent()
# take a const *") updated the arguments to the uevent callback
# function in Linux v6.3.
#
CODE="
#include <linux/device/bus.h>
int conftest_bus_type_struct_remove_has_int_return_type(const struct device *dev,
struct kobj_uevent_env *env,
struct bus_type *bus) {
return bus->uevent(dev, env);
}"
compile_check_conftest "$CODE" "NV_BUS_TYPE_STRUCT_UEVENT_HAS_CONST_DEV_ARG" "" "types"
;;
class_create_has_no_owner_arg)
#
# Determine if the class_create() function has the 'owner' argument.
@@ -6484,7 +6521,7 @@ compile_test() {
# Determine if the 'class' structure devnode function pointer
# has const 'struct dev' argument.
#
# Commit 43a7206b0963 ("driver core: class: make class_register()
# Commit ff62b8e6588f ("driver core: make struct class.devnode()
# take a const *") updated the class_register function to take a
# const class structure in Linux v6.2.
#
@@ -6533,6 +6570,24 @@ compile_test() {
compile_check_conftest "$CODE" "NV_DEVICE_ADD_DISK_HAS_INT_RETURN_TYPE" "" "types"
;;
devm_tegra_core_dev_init_opp_table_common)
#
# Determine whether devm_tegra_core_dev_init_opp_table_common is
# present.
#
# devm_tegra_core_dev_init_opp_table_common was added in commit
# 9131c6331726 ("soc/tegra: Add devm_tegra_core_dev_init_opp_table_common()")
# in Linux v5.17.
#
CODE="
#include <linux/thermal.h>
void conftest_devm_tegra_core_dev_init_opp_table_common(void) {
devm_tegra_core_dev_init_opp_table_common();
}"
compile_check_conftest "$CODE" "NV_DEVM_TEGRA_CORE_DEV_INIT_OPP_TABLE_COMMON_PRESENT" "" "functions"
;;
devm_thermal_of_zone_register)
#
# Determine whether devm_thermal_of_zone_register is present.
@@ -6617,6 +6672,25 @@ compile_test() {
compile_check_conftest "$CODE" "NV_DRM_APERTURE_REMOVE_FRAMEBUFFERS_HAS_NO_PRIMARY_ARG" "" "types"
;;
drm_debugfs_remove_files_has_root_arg)
#
# Determine if the function drm_debugfs_remove_files() has the 'root' argument.
#
# Commit 8e455145d8f1 ("drm/debugfs: rework drm_debugfs_create_files
# implementation v2") added a 'root' argument to the function
# drm_debugfs_remove_files() in Linux v6.7.
#
CODE="
#include <drm/drm_debugfs.h>
int conftest_drm_debugfs_remove_files_has_root_arg(const struct drm_info_list *files,
int count, struct dentry *root,
struct drm_minor *minor) {
return drm_debugfs_remove_files(files, count, root, minor);
}"
compile_check_conftest "$CODE" "NV_DRM_DEBUGFS_REMOVE_FILES_HAS_ROOT_ARG" "" "types"
;;
drm_driver_struct_has_irq_enabled_arg)
#
# Determine if the 'drm_driver' structure
@@ -6896,6 +6970,107 @@ compile_test() {
compile_check_conftest "$CODE" "NV_KTHREAD_COMPLETE_AND_EXIT_PRESENT" "" "functions"
;;
mii_bus_struct_has_read_c45)
#
# Determine if the 'mii_bus' structure has 'read_c45' field.
#
# Added in commit 4e4aafcddbbf ("net: mdio: Add dedicated C45 API to
# MDIO bus drivers") in Linux v6.3.
#
CODE="
#include <linux/phy.h>
int conftest_mii_bus_struct_has_read_c45(void) {
return offsetof(struct mii_bus, read_c45);
}"
compile_check_conftest "$CODE" "NV_MII_BUS_STRUCT_HAS_READ_C45" "" "types"
;;
mii_bus_struct_has_write_c45)
#
# Determine if the 'mii_bus' structure has 'write_c45' field.
#
# Added in commit 4e4aafcddbbf ("net: mdio: Add dedicated C45 API to
# MDIO bus drivers") in Linux v6.3.
#
CODE="
#include <linux/phy.h>
int conftest_mii_bus_struct_has_read_c45(void) {
return offsetof(struct mii_bus, write_c45);
}"
compile_check_conftest "$CODE" "NV_MII_BUS_STRUCT_HAS_WRITE_C45" "" "types"
;;
pwm_ops_struct_has_owner)
#
# Determine if the pwm_ops struct has an owner member.
#
# Added by commit 384461abcab6 ("pwm: Manage owner assignment implicitly
# for drivers") in Linux 6.7.
#
CODE="
#include <linux/pwm.h>
int conftest_pwm_ops_struct_has_owner(void) {
return offsetof(struct pwm_ops, owner);
}"
compile_check_conftest "$CODE" "NV_PWM_OPS_STRUCT_HAS_OWNER" "" "types"
;;
pci_disable_pcie_error_reporting)
#
# Determine if the pci_disable_pcie_error_reporting() API available or not.
#
# API pci_disable_pcie_error_reporting() is dropped from Linux 6.5
# with commit 69b264df8a4128 ("PCI/AER: Drop unused
# pci_disable_pcie_error_reporting()")
#
CODE="
#include <linux/aer.h>
void conftest_pci_disable_pcie_error_reporting(void) {
pci_disable_pcie_error_reporting();
}"
compile_check_conftest "$CODE" "NV_PCI_DISABLE_PCIE_ERROR_REPORTING_PRESENT" "" "functions"
;;
pci_enable_pcie_error_reporting)
#
# Determine if the pci_enable_pcie_error_reporting() API available.
#
# API pci_enable_pcie_error_reporting() is dropped from Linux 6.5
# with commit 7ec4b34be42345 ("PCI/AER: Unexport
# pci_disable_pcie_error_reporting()")
#
CODE="
#include <linux/aer.h>
void conftest_pci_enable_pcie_error_reporting(void) {
pci_enable_pcie_error_reporting();
}"
compile_check_conftest "$CODE" "NV_PCI_ENABLE_PCIE_ERROR_REPORTING_PRESENT" "" "functions"
;;
pci_epf_driver_struct_probe_has_id_arg)
#
# 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 change 081c715dfd5054 ("PCI: endpoint: Pass EPF device ID to the probe function")
# in Linux 6.4.
#
CODE="
#include <linux/pci-epf.h>
void conftest_pci_epf_driver_struct_probe_has_id_arg(struct pci_epf_driver *epfd) {
epfd->probe(NULL);
}"
compile_check_conftest "$CODE" "NV_PCI_EPF_DRIVER_STRUCT_PROBE_HAS_ID_ARG" "" "functions"
;;
register_shrinker_has_fmt_arg)
#
# Determine if the 'register_shrinker' function
@@ -6933,6 +7108,24 @@ compile_test() {
compile_check_conftest "$CODE" "NV_REQUEST_STRUCT_HAS_COMPLETION_DATA_ARG" "" "types"
;;
shrinker_alloc)
#
# Determine if the shrinker alloc present or not.
#
# In Linux v6.7, commit c42d50aefd17 ("mm: shrinker: add infrastructure for
# dynamically allocating shrinker")
#
CODE="
#include <linux/atomic.h>
#include <linux/compiler_attributes.h>
#include <linux/shrinker.h>
void conftest_shrinker_alloc(void) {
shrinker_alloc();
}"
compile_check_conftest "$CODE" "NV_SHRINKER_ALLOC_PRESENT" "" "functions"
;;
snd_soc_card_jack_new_has_no_snd_soc_jack_pins)
#
# Determine if the function snd_soc_card_jack_new() has 'pins' and
@@ -7010,6 +7203,41 @@ compile_test() {
compile_check_conftest "$CODE" "NV_SND_SOC_OF_GET_DAI_NAME_HAS_INDEX_ARG" "" "types"
;;
snd_soc_rtd_to_codec)
#
# Determine if the snd_soc_rtd_to_codec() present or not
#
# In Linux v6.7, commit 1d5a2b5dd0a8d2 ("ASoC: soc.h: convert asoc_xxx()
# to snd_soc_xxx()") to replace all asoc_xxx() to snd_soc_xxx().
#
CODE="
#include <sound/soc.h>
void conftest_snd_soc_rtd_to_codec(void) {
snd_soc_rtd_to_codec();
}"
compile_check_conftest "$CODE" "NV_SND_SOC_RTD_TO_CODEC_PRESENT" "" "functions"
;;
simple_util_dai_init)
#
# Determine if the simple_util_dai_init() is present. This will help on finding
# if asoc_simple_xxx() renamed to simple_util_xxx()
#
# 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().
#
CODE="
#include <sound/soc.h>
#include <sound/simple_card_utils.h>
void conftest_simple_util_dai_init(void) {
simple_util_dai_init();
}"
compile_check_conftest "$CODE" "NV_ASOC_SIMPLE_RENAMED_SIMPLE" "" "functions"
;;
tc_taprio_qopt_offload_struct_has_cmd)
#
# Determine if struct tc_taprio_qopt_offload has a member named cmd

View File

@@ -3,6 +3,8 @@
* Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*/
#include <nvidia/conftest.h>
#include <linux/dma-mapping.h>
#include <linux/module.h>
#include <linux/version.h>
@@ -37,13 +39,21 @@ static int tegra_alt_pcm_open(struct snd_soc_component *component,
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct tegra_alt_pcm_dma_params *dmap;
struct dma_chan *chan;
#if defined(NV_SND_SOC_RTD_TO_CODEC_PRESENT) /* Linux 6.7*/
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
#else
struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
#endif
int ret;
if (rtd->dai_link->no_pcm)
return 0;
#if defined(NV_SND_SOC_RTD_TO_CODEC_PRESENT) /* Linux 6.7*/
dmap = snd_soc_dai_get_dma_data(snd_soc_rtd_to_cpu(rtd, 0), substream);
#else
dmap = snd_soc_dai_get_dma_data(asoc_rtd_to_cpu(rtd, 0), substream);
#endif
/* Set HW params now that initialization is complete */
snd_soc_set_runtime_hwparams(substream, &tegra_alt_pcm_hardware);
@@ -106,7 +116,11 @@ static int tegra_alt_pcm_hw_params(struct snd_soc_component *component,
if (rtd->dai_link->no_pcm)
return 0;
#if defined(NV_SND_SOC_RTD_TO_CODEC_PRESENT) /* Linux 6.7*/
dmap = snd_soc_dai_get_dma_data(snd_soc_rtd_to_cpu(rtd, 0), substream);
#else
dmap = snd_soc_dai_get_dma_data(asoc_rtd_to_cpu(rtd, 0), substream);
#endif
if (!dmap)
return 0;
@@ -249,8 +263,13 @@ static int tegra_alt_pcm_dma_allocate(struct snd_soc_pcm_runtime *rtd,
if (ret)
return ret;
#if defined(NV_SND_SOC_RTD_TO_CODEC_PRESENT) /* Linux 6.7*/
dmap = snd_soc_dai_get_dma_data(snd_soc_rtd_to_cpu(rtd, 0),
pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream);
#else
dmap = snd_soc_dai_get_dma_data(asoc_rtd_to_cpu(rtd, 0),
pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream);
#endif
if (dmap->buffer_size > size)
buffer_size = dmap->buffer_size;
if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
@@ -261,8 +280,13 @@ static int tegra_alt_pcm_dma_allocate(struct snd_soc_pcm_runtime *rtd,
goto err;
}
#if defined(NV_SND_SOC_RTD_TO_CODEC_PRESENT) /* Linux 6.7*/
dmap = snd_soc_dai_get_dma_data(snd_soc_rtd_to_cpu(rtd, 0),
pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream);
#else
dmap = snd_soc_dai_get_dma_data(asoc_rtd_to_cpu(rtd, 0),
pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream);
#endif
if (dmap->buffer_size > size)
buffer_size = dmap->buffer_size;
if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {

View File

@@ -203,9 +203,14 @@ static int tegra_virt_machine_driver_probe(struct platform_device *pdev)
}
list_for_each_entry(rtd, &card->rtd_list, list) {
#if defined(NV_SND_SOC_RTD_TO_CODEC_PRESENT) /* Linux 6.7*/
struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0);
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
#else
struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
struct snd_soc_dai_driver *codec_drv = codec_dai->driver;
struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
#endif
struct snd_soc_dai_driver *codec_drv = codec_dai->driver;
struct snd_soc_dai_driver *cpu_drv = cpu_dai->driver;
cpu_drv->playback.rates = SNDRV_PCM_RATE_KNOT;

View File

@@ -498,18 +498,32 @@ static int parse_dt_dai_links(struct snd_soc_card *card,
if (of_property_read_string(link_node,
"link-name",
&dai_link->name)) {
#if defined(NV_ASOC_SIMPLE_RENAMED_SIMPLE) /* Linux 6.7 */
ret = simple_util_set_dailink_name(
&pdev->dev, dai_link, "%s-%d",
"tegra-dlink", link_count);
#else
ret = asoc_simple_set_dailink_name(
&pdev->dev, dai_link, "%s-%d",
"tegra-dlink", link_count);
#endif
if (ret < 0)
goto cleanup;
}
#if defined(NV_ASOC_SIMPLE_RENAMED_SIMPLE) /* Linux 6.7 */
simple_util_parse_daifmt(&pdev->dev, link_node, codec,
NULL, &dai_link->dai_fmt);
simple_util_canonicalize_platform(dai_link->platforms,
dai_link->cpus);
#else
asoc_simple_parse_daifmt(&pdev->dev, link_node, codec,
NULL, &dai_link->dai_fmt);
asoc_simple_canonicalize_platform(dai_link->platforms,
dai_link->cpus);
#endif
of_property_read_u32(link_node, "link-type",
&link_type);
@@ -582,7 +596,11 @@ int parse_card_info(struct snd_soc_card *card, struct snd_soc_ops *pcm_ops,
struct device_node *node = card->dev->of_node;
int ret;
#if defined(NV_ASOC_SIMPLE_RENAMED_SIMPLE) /* Linux 6.7 */
ret = simple_util_parse_card_name(card, PREFIX);
#else
ret = asoc_simple_parse_card_name(card, PREFIX);
#endif
if (ret < 0)
return ret;

View File

@@ -434,10 +434,12 @@ int tegra_asoc_utils_init(struct tegra_asoc_utils_data *data,
* and suspend-resume functionality on Tegra30, although audio mclk is
* only needed for audio.
*/
ret = clk_prepare_enable(data->clk_cdev1);
if (ret) {
dev_err(data->dev, "Can't enable cdev1: %d\n", ret);
return ret;
if (data->soc == TEGRA_ASOC_UTILS_SOC_TEGRA30) {
ret = clk_prepare_enable(data->clk_cdev1);
if (ret) {
dev_err(data->dev, "Can't enable cdev1: %d\n", ret);
return ret;
}
}
return 0;

View File

@@ -22,8 +22,13 @@
static int tegra_audio_dai_init(struct snd_soc_pcm_runtime *rtd)
{
/* Used for audio graph based sound cards only */
#if defined(NV_ASOC_SIMPLE_RENAMED_SIMPLE) /* Linux 6.7 */
if (rtd->card->component_chaining)
return simple_util_dai_init(rtd);
#else
if (rtd->card->component_chaining)
return asoc_simple_dai_init(rtd);
#endif
return 0;
}