aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/host1x.h
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2013-10-14 08:43:22 -0400
committerThierry Reding <treding@nvidia.com>2013-10-31 04:55:33 -0400
commit776dc38403676f499a73d32e2e7c61eb5b42f736 (patch)
tree5c9f8d670b51d743c5bbab45ec401e30f22579c1 /include/linux/host1x.h
parent35d747a81d7eb824bd0c3476cd0c564b52ad5353 (diff)
drm/tegra: Move subdevice infrastructure to host1x
The Tegra DRM driver currently uses some infrastructure to defer the DRM core initialization until all required devices have registered. The same infrastructure can potentially be used by any other driver that requires more than a single sub-device of the host1x module. Make the infrastructure more generic and keep only the DRM specific code in the DRM part of the driver. Eventually this will make it easy to move the DRM driver part back to the DRM subsystem. Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'include/linux/host1x.h')
-rw-r--r--include/linux/host1x.h45
1 files changed, 44 insertions, 1 deletions
diff --git a/include/linux/host1x.h b/include/linux/host1x.h
index 7442f2a57039..e62c61a4afa9 100644
--- a/include/linux/host1x.h
+++ b/include/linux/host1x.h
@@ -19,7 +19,7 @@
19#ifndef __LINUX_HOST1X_H 19#ifndef __LINUX_HOST1X_H
20#define __LINUX_HOST1X_H 20#define __LINUX_HOST1X_H
21 21
22#include <linux/kref.h> 22#include <linux/device.h>
23#include <linux/types.h> 23#include <linux/types.h>
24 24
25enum host1x_class { 25enum host1x_class {
@@ -37,6 +37,7 @@ struct host1x_client_ops {
37 37
38struct host1x_client { 38struct host1x_client {
39 struct list_head list; 39 struct list_head list;
40 struct device *parent;
40 struct device *dev; 41 struct device *dev;
41 42
42 const struct host1x_client_ops *ops; 43 const struct host1x_client_ops *ops;
@@ -230,4 +231,46 @@ void host1x_job_put(struct host1x_job *job);
230int host1x_job_pin(struct host1x_job *job, struct device *dev); 231int host1x_job_pin(struct host1x_job *job, struct device *dev);
231void host1x_job_unpin(struct host1x_job *job); 232void host1x_job_unpin(struct host1x_job *job);
232 233
234/*
235 * subdevice probe infrastructure
236 */
237
238struct host1x_device;
239
240struct host1x_driver {
241 const struct of_device_id *subdevs;
242 struct list_head list;
243 const char *name;
244
245 int (*probe)(struct host1x_device *device);
246 int (*remove)(struct host1x_device *device);
247};
248
249int host1x_driver_register(struct host1x_driver *driver);
250void host1x_driver_unregister(struct host1x_driver *driver);
251
252struct host1x_device {
253 struct host1x_driver *driver;
254 struct list_head list;
255 struct device dev;
256
257 struct mutex subdevs_lock;
258 struct list_head subdevs;
259 struct list_head active;
260
261 struct mutex clients_lock;
262 struct list_head clients;
263};
264
265static inline struct host1x_device *to_host1x_device(struct device *dev)
266{
267 return container_of(dev, struct host1x_device, dev);
268}
269
270int host1x_device_init(struct host1x_device *device);
271int host1x_device_exit(struct host1x_device *device);
272
273int host1x_client_register(struct host1x_client *client);
274int host1x_client_unregister(struct host1x_client *client);
275
233#endif 276#endif