mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-28 09:31:14 +00:00
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>
This commit is contained in:
parent
35d747a81d
commit
776dc38403
13 changed files with 898 additions and 365 deletions
|
@ -19,7 +19,7 @@
|
|||
#ifndef __LINUX_HOST1X_H
|
||||
#define __LINUX_HOST1X_H
|
||||
|
||||
#include <linux/kref.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
enum host1x_class {
|
||||
|
@ -37,6 +37,7 @@ struct host1x_client_ops {
|
|||
|
||||
struct host1x_client {
|
||||
struct list_head list;
|
||||
struct device *parent;
|
||||
struct device *dev;
|
||||
|
||||
const struct host1x_client_ops *ops;
|
||||
|
@ -230,4 +231,46 @@ void host1x_job_put(struct host1x_job *job);
|
|||
int host1x_job_pin(struct host1x_job *job, struct device *dev);
|
||||
void host1x_job_unpin(struct host1x_job *job);
|
||||
|
||||
/*
|
||||
* subdevice probe infrastructure
|
||||
*/
|
||||
|
||||
struct host1x_device;
|
||||
|
||||
struct host1x_driver {
|
||||
const struct of_device_id *subdevs;
|
||||
struct list_head list;
|
||||
const char *name;
|
||||
|
||||
int (*probe)(struct host1x_device *device);
|
||||
int (*remove)(struct host1x_device *device);
|
||||
};
|
||||
|
||||
int host1x_driver_register(struct host1x_driver *driver);
|
||||
void host1x_driver_unregister(struct host1x_driver *driver);
|
||||
|
||||
struct host1x_device {
|
||||
struct host1x_driver *driver;
|
||||
struct list_head list;
|
||||
struct device dev;
|
||||
|
||||
struct mutex subdevs_lock;
|
||||
struct list_head subdevs;
|
||||
struct list_head active;
|
||||
|
||||
struct mutex clients_lock;
|
||||
struct list_head clients;
|
||||
};
|
||||
|
||||
static inline struct host1x_device *to_host1x_device(struct device *dev)
|
||||
{
|
||||
return container_of(dev, struct host1x_device, dev);
|
||||
}
|
||||
|
||||
int host1x_device_init(struct host1x_device *device);
|
||||
int host1x_device_exit(struct host1x_device *device);
|
||||
|
||||
int host1x_client_register(struct host1x_client *client);
|
||||
int host1x_client_unregister(struct host1x_client *client);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue