diff --git a/drivers/platform/tegra/dce/Makefile b/drivers/platform/tegra/dce/Makefile index a600bb35..7e16e282 100644 --- a/drivers/platform/tegra/dce/Makefile +++ b/drivers/platform/tegra/dce/Makefile @@ -9,9 +9,15 @@ ccflags-y += -Wno-error=cpp ifeq ($(VERSION),4) ccflags-y += -Wextra -Wno-unused-parameter -Wno-missing-field-initializers endif -obj-$(CONFIG_TEGRA_DCE) += tegra-dce.o -tegra-dce-y += \ +# Set config when build as OOT module. +ifeq ($(CONFIG_TEGRA_OOT_MODULE),m) +CONFIG_TEGRA_DCE := m +ccflags-y += -I$(srctree.nvidia)/include +endif + +obj-$(CONFIG_TEGRA_DCE) += tegra-dce.o +tegra-dce-$(CONFIG_TEGRA_DCE) += \ dce-ast.o \ dce-reset.o \ dce-hsp-smb.o \ @@ -28,7 +34,9 @@ tegra-dce-y += \ dce-module.o \ dce-util-common.o -tegra-dce-$(CONFIG_DEBUG_FS) += \ +ifeq ($(CONFIG_DEBUG_FS),y) +tegra-dce-$(CONFIG_TEGRA_DCE) += \ dce-debug.o +endif ccflags-y += -I$(srctree.nvidia-t23x)/drivers/platform/tegra/dce/include diff --git a/drivers/platform/tegra/dce/dce-ipc.c b/drivers/platform/tegra/dce/dce-ipc.c index d28ac499..e5d297dd 100644 --- a/drivers/platform/tegra/dce/dce-ipc.c +++ b/drivers/platform/tegra/dce/dce-ipc.c @@ -201,13 +201,13 @@ void dce_ipc_free_region(struct tegra_dce *d) /** * dce_ipc_signal_target - Generic function to signal target. * - * @d_ivc : Pointer to struct ivc. + * @d_ivc : Pointer to struct tegra_ivc. * * Do not take a channel lock here. * * Return : Void. */ -static void dce_ipc_signal_target(struct ivc *ivc) +static void dce_ipc_signal_target(struct tegra_ivc *ivc, void *data) { } @@ -336,12 +336,10 @@ int dce_ipc_channel_init(struct tegra_dce *d, u32 ch_type) dev = dev_from_dce(d); - ret = tegra_ivc_init_with_dma_handle(&ch->d_ivc, - (uintptr_t)r->base + r->s_offset, - r->iova + r->s_offset, - (uintptr_t)r->base + r->s_offset + q_sz, - r->iova + r->s_offset + q_sz, - q_info->nframes, msg_sz, dev, dce_ipc_signal_target); + ret = tegra_ivc_init(&ch->d_ivc, NULL, r->base + r->s_offset, + r->iova + r->s_offset, r->base + r->s_offset + q_sz, + r->iova + r->s_offset + q_sz, q_info->nframes, msg_sz, + dce_ipc_signal_target, NULL); if (ret) { dce_err(d, "IVC creation failed"); goto out_lock_destroy; @@ -432,7 +430,7 @@ bool dce_ipc_channel_is_ready(struct tegra_dce *d, u32 ch_type) dce_mutex_lock(&ch->lock); - ret = (tegra_ivc_channel_notified(&ch->d_ivc) ? false : true); + ret = (tegra_ivc_notified(&ch->d_ivc) ? false : true); if (ret == false) ch->signal.notify(d, &ch->signal.to_d); @@ -480,7 +478,7 @@ void dce_ipc_channel_reset(struct tegra_dce *d, u32 ch_type) dce_mutex_lock(&ch->lock); - tegra_ivc_channel_reset(&ch->d_ivc); + tegra_ivc_reset(&ch->d_ivc); trace_ivc_channel_reset_triggered(d, ch); @@ -793,11 +791,13 @@ int dce_ipc_get_region_iova_info(struct tegra_dce *d, u64 *iova, u32 *size) bool dce_ipc_is_data_available(struct tegra_dce *d, u32 ch_type) { bool ret = false; + void *frame; struct dce_ipc_channel *ch = d->d_ipc.ch[ch_type]; dce_mutex_lock(&ch->lock); - if (tegra_ivc_can_read(&ch->d_ivc)) + frame = tegra_ivc_read_get_next_frame(&ch->d_ivc); + if (!IS_ERR(frame)) ret = true; dce_mutex_unlock(&ch->lock); diff --git a/drivers/platform/tegra/dce/include/dce-ipc.h b/drivers/platform/tegra/dce/include/dce-ipc.h index 21bc3019..50cb4534 100644 --- a/drivers/platform/tegra/dce/include/dce-ipc.h +++ b/drivers/platform/tegra/dce/include/dce-ipc.h @@ -15,8 +15,7 @@ #define DCE_IPC_H #include -#include -#include +#include #include #include #include @@ -131,7 +130,7 @@ struct dce_ipc_channel { u32 ipc_type; void *ibuff; void *obuff; - struct ivc d_ivc; + struct tegra_ivc d_ivc; struct tegra_dce *d; struct dce_mutex lock; struct dce_ipc_signal signal; diff --git a/include/trace/events/dce_events.h b/include/trace/events/dce_events.h index 198397ac..276d597d 100644 --- a/include/trace/events/dce_events.h +++ b/include/trace/events/dce_events.h @@ -1,9 +1,5 @@ /* - * include/trace/events/dce_events.h - * - * Display event logging to ftrace. - * - * Copyright (c) 2020-, NVIDIA CORPORATION, All rights reserved. + * Copyright (c) 2020-2022, NVIDIA CORPORATION, All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -45,7 +41,7 @@ DECLARE_EVENT_CLASS(dce_ipc_events_notifier, "No of Frames = [%u], Rx Iova = [0x%llx], Tx Iova = [0x%llx], Region Current Offset = [%u], Region Iova Base = [0x%llx], " "Region Size = [%lu] Region Base Address = [0x%p]", __entry->ch->ch_type, __entry->ch->flags, __entry->ch->w_type, - __entry->ch->d_ivc.w_pos, __entry->ch->d_ivc.r_pos, + __entry->ch->d_ivc.tx.position, __entry->ch->d_ivc.rx.position, __entry->ch->q_info.frame_sz, __entry->ch->q_info.nframes, __entry->ch->q_info.rx_iova, __entry->ch->q_info.tx_iova, __entry->d->d_ipc.region.s_offset, __entry->d->d_ipc.region.iova,