mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-25 02:32:08 +03:00
Compare commits
46 Commits
rel-38
...
rel-36_eng
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f255a170a7 | ||
|
|
020bdeded8 | ||
|
|
e1471516b0 | ||
|
|
0ca520ee30 | ||
|
|
6b290b7f84 | ||
|
|
b5178e70d8 | ||
|
|
efbbf91f79 | ||
|
|
29ab9b19c9 | ||
|
|
1432eb248d | ||
|
|
4ab98ef641 | ||
|
|
7f9beef481 | ||
|
|
069d6bb3eb | ||
|
|
7f3751f642 | ||
|
|
e91b43420c | ||
|
|
5b6fed0199 | ||
|
|
7c4bfe82b2 | ||
|
|
1b537bff19 | ||
|
|
75363cdd58 | ||
|
|
09b54bda42 | ||
|
|
4a1a87890d | ||
|
|
ab8b8a6c84 | ||
|
|
9c77439e40 | ||
|
|
715c34434f | ||
|
|
c196de1377 | ||
|
|
0940779cd6 | ||
|
|
029ade906d | ||
|
|
b5d808a6ff | ||
|
|
6fe3abc899 | ||
|
|
a6701b19b9 | ||
|
|
daec781815 | ||
|
|
60adf47e0f | ||
|
|
7997b6e8b0 | ||
|
|
b02f2cd5ee | ||
|
|
ee4493d7bf | ||
|
|
9c2150982a | ||
|
|
9e94468082 | ||
|
|
4f1d3dbeb3 | ||
|
|
4da134034b | ||
|
|
2527826ca1 | ||
|
|
5fe2e2aacc | ||
|
|
067fbd7bbc | ||
|
|
856471d64f | ||
|
|
a3b3ef5cab | ||
|
|
7ffd0c9cfa | ||
|
|
7ff7dcd36a | ||
|
|
c0bc0aa39c |
14
Makefile
14
Makefile
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -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>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -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";
|
||||
};
|
||||
@@ -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 = \
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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");
|
||||
@@ -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)
|
||||
|
||||
@@ -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...) \
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 \
|
||||
|
||||
124
drivers/platform/tegra/aon/tegra-aon-ivc-echo.c
Normal file
124
drivers/platform/tegra/aon/tegra-aon-ivc-echo.c
Normal 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");
|
||||
@@ -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>
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
11
drivers/platform/tegra/tegra_bootloader_debug.h
Normal file
11
drivers/platform/tegra/tegra_bootloader_debug.h
Normal 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
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
257
drivers/thermal/thermal-trip-event.c
Normal file
257
drivers/thermal/thermal-trip-event.c
Normal 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");
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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>
|
||||
|
||||
17
include/linux/spi/spi-tegra124-slave.h
Normal file
17
include/linux/spi/spi-tegra124-slave.h
Normal 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
|
||||
11
include/media/nv_hawk_owl.h
Normal file
11
include/media/nv_hawk_owl.h
Normal 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
|
||||
@@ -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);
|
||||
|
||||
@@ -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__
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user