2 * drivers/video/tegra/host/tpg/tpg.c
4 * Tegra VI test pattern generator driver
6 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms and conditions of the GNU General Public License,
10 * version 2, as published by the Free Software Foundation.
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include <linux/init.h>
22 #include <linux/export.h>
23 #include <linux/module.h>
28 #define TPG_CHANNELS 6
30 static struct tegra_csi_device tpg_csi;
31 static struct tegra_mc_vi tpg_mc_vi;
33 static int tpg_probe(struct vi *tegra_vi)
35 struct tegra_csi_device *csi = &tpg_csi;
36 struct tegra_mc_vi *mc_vi = &tpg_mc_vi;
37 struct platform_device *pdev = tegra_vi->ndev;
40 /* Init CSI related media controller interface */
41 csi->num_ports = TPG_CHANNELS;
42 csi->pg_mode = TEGRA_VI_PG_PATCH;
43 ret = tegra_csi_media_controller_init(csi, pdev);
47 /* Init Tegra VI TPG channels */
50 mc_vi->reg = tegra_vi->reg;
51 mc_vi->pg_mode = TEGRA_VI_PG_PATCH;
52 mc_vi->num_channels = TPG_CHANNELS;
53 mc_vi->fops = tegra_vi->data->vi_fops;
54 ret = tegra_vi_media_controller_init(mc_vi, pdev);
60 tegra_csi_media_controller_remove(csi);
64 static int __exit tpg_remove(struct vi *tegra_vi)
66 struct tegra_csi_device *csi = &tpg_csi;
67 struct tegra_mc_vi *mc_vi = &tpg_mc_vi;
69 tegra_csi_media_controller_remove(csi);
70 tegra_vi_channels_cleanup(mc_vi);
71 tegra_vi_v4l2_cleanup(mc_vi);
76 static int __init tpg_init(void)
78 struct vi *tegra_vi = tegra_vi_get();
80 return tpg_probe(tegra_vi);
85 static void __exit tpg_exit(void)
87 struct vi *tegra_vi = tegra_vi_get();
92 module_init(tpg_init);
93 module_exit(tpg_exit);
94 MODULE_LICENSE("GPL v2");