From e3f7ab90e1f001f0d37b32f980c2c75191df32bd Mon Sep 17 00:00:00 2001 From: Laxman Dewangan Date: Tue, 12 Dec 2023 11:43:06 +0000 Subject: [PATCH] rtcpu: capture-ivc: Enable build for Linux 6.2 The driver of rtcpu/capture-ivc is modified to support the new APIs of the IVC from core kernel using conftest. Enable build of this driver. Bug 4346767 Change-Id: I427bb8b7d5dad02e805d0707fb67e45772fead31 Signed-off-by: Laxman Dewangan Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3033024 (cherry picked from commit bf1cfb5fb4e9cec90d88bd0f233a04d3aeb9c1d6) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3053700 Reviewed-by: Jonathan Hunter GVS: Gerrit_Virtual_Submit Tested-by: Jonathan Hunter --- drivers/platform/tegra/rtcpu/Makefile | 4 +- drivers/platform/tegra/rtcpu/capture-ivc.c | 24 +++++++-- include/linux/tegra-capture-ivc.h | 58 +--------------------- 3 files changed, 22 insertions(+), 64 deletions(-) diff --git a/drivers/platform/tegra/rtcpu/Makefile b/drivers/platform/tegra/rtcpu/Makefile index c5e74184..695c3697 100644 --- a/drivers/platform/tegra/rtcpu/Makefile +++ b/drivers/platform/tegra/rtcpu/Makefile @@ -1,11 +1,9 @@ # SPDX-License-Identifier: GPL-2.0-only -# Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. ccflags-y += -Wframe-larger-than=2048 -ifneq ($(CONFIG_TEGRA_IVC_LEGACY_DISABLE),y) obj-m += capture-ivc.o -endif obj-m += ivc-bus.o obj-m += camchar.o obj-m += camera-diagnostics.o diff --git a/drivers/platform/tegra/rtcpu/capture-ivc.c b/drivers/platform/tegra/rtcpu/capture-ivc.c index 901b2019..14e1ba3e 100644 --- a/drivers/platform/tegra/rtcpu/capture-ivc.c +++ b/drivers/platform/tegra/rtcpu/capture-ivc.c @@ -1,5 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 -// Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + +#include #include @@ -357,11 +359,25 @@ static inline void tegra_capture_ivc_recv(struct tegra_capture_ivc *civc) { struct tegra_ivc *ivc = &civc->chan->ivc; struct device *dev = &civc->chan->dev; + const void *msg; + const struct tegra_capture_ivc_msg_header *hdr; + uint32_t id; while (tegra_ivc_can_read(ivc)) { - const void *msg = tegra_ivc_read_get_next_frame(ivc); - const struct tegra_capture_ivc_msg_header *hdr = msg; - uint32_t id = hdr->channel_id; +#if defined(NV_TEGRA_IVC_STRUCT_HAS_IOSYS_MAP) /* Linux 6.2 */ + struct iosys_map map; + int err; + err = tegra_ivc_read_get_next_frame(ivc, &map); + if (err) { + dev_err(dev, "Failed to get next frame for read\n"); + return; + } + msg = map.vaddr; +#else + msg = tegra_ivc_read_get_next_frame(ivc); +#endif + hdr = msg; + id = hdr->channel_id; trace_capture_ivc_recv(dev_name(dev), hdr->msg_id, id); diff --git a/include/linux/tegra-capture-ivc.h b/include/linux/tegra-capture-ivc.h index a9dfc4ca..345b565f 100644 --- a/include/linux/tegra-capture-ivc.h +++ b/include/linux/tegra-capture-ivc.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. + * Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. */ #ifndef INCLUDE_CAPTURE_IVC_H @@ -9,7 +9,6 @@ #include #include -#if !defined(CONFIG_TEGRA_IVC_LEGACY_DISABLE) /** * @brief Submit the control message binary blob to capture-IVC driver, * which is to be transferred over control IVC channel to RTCPU. @@ -134,59 +133,4 @@ int tegra_capture_ivc_unregister_control_cb( */ int tegra_capture_ivc_unregister_capture_cb( uint32_t chan_id); -#else -typedef void (*tegra_capture_ivc_cb_func)( - const void *resp_desc, - const void *priv_context); - -static inline int tegra_capture_ivc_control_submit( - const void *control_desc, - size_t len) -{ - return -ENOTSUPP; -}; - -static inline int tegra_capture_ivc_capture_submit( - const void *capture_desc, - size_t len) -{ - return -ENOTSUPP; -}; - -static inline int tegra_capture_ivc_register_control_cb( - tegra_capture_ivc_cb_func control_resp_cb, - uint32_t *trans_id, - const void *priv_context) -{ - return -ENOTSUPP; -}; - -static inline int tegra_capture_ivc_notify_chan_id( - uint32_t chan_id, - uint32_t trans_id) -{ - return -ENOTSUPP; -}; - -static inline int tegra_capture_ivc_register_capture_cb( - tegra_capture_ivc_cb_func capture_status_ind_cb, - uint32_t chan_id, - const void *priv_context) -{ - return -ENOTSUPP; -}; - -static inline int tegra_capture_ivc_unregister_control_cb( - uint32_t id) -{ - return -ENOTSUPP; -}; - -static inline int tegra_capture_ivc_unregister_capture_cb( - uint32_t chan_id) -{ - return -ENOTSUPP; -}; -#endif /* !defined(CONFIG_TEGRA_IVC_LEGACY_DISABLE) */ - #endif /* INCLUDE_CAPTURE_IVC_H */