2 * drivers/video/tegra/host/host1x/host1x.h
4 * Tegra Graphics Host Driver Entrypoint
6 * Copyright (c) 2010-2014, 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 #ifndef __NVHOST_HOST1X_H
22 #define __NVHOST_HOST1X_H
24 #include <linux/cdev.h>
25 #include <linux/nvhost.h>
27 #include "nvhost_syncpt.h"
28 #include "nvhost_channel.h"
29 #include "nvhost_intr.h"
31 #define TRACE_MAX_LENGTH 128U
32 #define IFACE_NAME "nvhost"
34 struct nvhost_channel;
37 struct host1x_device_info {
38 int nb_channels; /* host1x: num channels supported */
39 int nb_pts; /* host1x: num syncpoints supported */
40 int nb_bases; /* host1x: num syncpoints supported */
41 int nb_mlocks; /* host1x: number of mlocks */
44 struct nvhost_master {
45 void __iomem *aperture;
46 void __iomem *sync_aperture;
47 struct class *nvhost_class;
50 struct nvhost_syncpt syncpt;
51 struct nvhost_intr intr;
52 struct platform_device *dev;
54 struct host1x_device_info info;
55 struct kobject *caps_kobj;
56 struct nvhost_capability_node *caps_nodes;
57 struct mutex timeout_mutex;
59 struct nvhost_channel **chlist; /* channel list */
60 struct mutex chlist_mutex; /* mutex for channel list */
61 unsigned long allocated_channels;
62 unsigned long next_free_ch;
65 extern struct nvhost_master *nvhost;
67 void nvhost_debug_init(struct nvhost_master *master);
68 void nvhost_device_debug_init(struct platform_device *dev);
69 void nvhost_device_debug_deinit(struct platform_device *dev);
70 void nvhost_debug_dump(struct nvhost_master *master);
72 int nvhost_host1x_finalize_poweron(struct platform_device *dev);
73 int nvhost_host1x_prepare_poweroff(struct platform_device *dev);
75 void nvhost_set_chanops(struct nvhost_channel *ch);
77 int nvhost_gather_filter_enabled(struct nvhost_syncpt *sp);
79 extern pid_t nvhost_debug_null_kickoff_pid;
81 static inline void *nvhost_get_private_data(struct platform_device *_dev)
83 struct nvhost_device_data *pdata =
84 (struct nvhost_device_data *)platform_get_drvdata(_dev);
86 return pdata ? pdata->private_data : NULL;
89 static inline void nvhost_set_private_data(struct platform_device *_dev,
92 struct nvhost_device_data *pdata =
93 (struct nvhost_device_data *)platform_get_drvdata(_dev);
95 pdata->private_data = priv_data;
98 static inline struct nvhost_master *nvhost_get_host(
99 struct platform_device *_dev)
101 struct platform_device *pdev;
103 if (_dev->dev.parent && _dev->dev.parent != &platform_bus) {
104 pdev = to_platform_device(_dev->dev.parent);
105 return nvhost_get_private_data(pdev);
107 return nvhost_get_private_data(_dev);
110 static inline struct platform_device *nvhost_get_parent(
111 struct platform_device *_dev)
113 return (_dev->dev.parent && _dev->dev.parent != &platform_bus)
114 ? to_platform_device(_dev->dev.parent) : NULL;