From 27cb8a37fcfd9d992bb2ddf82222eafbf7ecd2c2 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Thu, 3 Mar 2016 19:15:24 +0530 Subject: [PATCH] drm/tegra: add T186 support to VIC Define vic_t186_config and vic_t186_ops for VIC Define .load_regs = vic_load_streamid_regs() for VIC streamid support Bug 1704301 Change-Id: Ib364c773c6c340c30e2644ef0baca500d89de55c Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/1023439 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Arto Merilainen GVS: Gerrit_Virtual_Submit Reviewed-by: Shridhar Rasal --- drivers/gpu/drm/tegra/Makefile | 7 +++++ drivers/gpu/drm/tegra/vic_t186.c | 48 ++++++++++++++++++++++++++++++++ drivers/gpu/drm/tegra/vic_t186.h | 27 ++++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 drivers/gpu/drm/tegra/Makefile create mode 100644 drivers/gpu/drm/tegra/vic_t186.c create mode 100644 drivers/gpu/drm/tegra/vic_t186.h diff --git a/drivers/gpu/drm/tegra/Makefile b/drivers/gpu/drm/tegra/Makefile new file mode 100644 index 00000000..7b2ba155 --- /dev/null +++ b/drivers/gpu/drm/tegra/Makefile @@ -0,0 +1,7 @@ +ccflags-y += -Idrivers/gpu/drm/tegra +ccflags-y += -I../kernel-t18x/drivers/gpu/drm/tegra + +tegra-drm-t186-y = \ + vic_t186.o + +obj-$(CONFIG_TEGRA_HOST1X) += tegra-drm-t186.o diff --git a/drivers/gpu/drm/tegra/vic_t186.c b/drivers/gpu/drm/tegra/vic_t186.c new file mode 100644 index 00000000..c6efe1e8 --- /dev/null +++ b/drivers/gpu/drm/tegra/vic_t186.c @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2016 NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "drm.h" +#include "vic_t186.h" + +#include + +static int vic_load_streamid_regs(struct tegra_drm_client *client) +{ + struct vic *vic = to_vic(client); + int streamid = -EINVAL; + + streamid = iommu_get_hwid(vic->dev->archdata.iommu, vic->dev, 0); + + if (streamid >= 0) { + vic_writel(vic, streamid, VIC_THI_STREAMID0); + vic_writel(vic, streamid, VIC_THI_STREAMID1); + } + + return 0; +} + +static const struct tegra_drm_client_ops vic_t186_ops = { + .open_channel = vic_open_channel, + .close_channel = vic_close_channel, + .is_addr_reg = vic_is_addr_reg, + .submit = tegra_drm_submit, + .load_regs = vic_load_streamid_regs, +}; + +const struct vic_config vic_t186_config = { + .ucode_name = "tegra18x/vic04_ucode.bin", + .drm_client_ops = &vic_t186_ops, +}; diff --git a/drivers/gpu/drm/tegra/vic_t186.h b/drivers/gpu/drm/tegra/vic_t186.h new file mode 100644 index 00000000..e819dd49 --- /dev/null +++ b/drivers/gpu/drm/tegra/vic_t186.h @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2016 NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef TEGRA_VIC_T186_H +#define TEGRA_VIC_T186_H + +#include "vic.h" + +#define VIC_THI_STREAMID0 0x30 +#define VIC_THI_STREAMID1 0x34 + +extern const struct vic_config vic_t186_config; + +#endif