diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/nvhost.h | 61 |
1 files changed, 40 insertions, 21 deletions
diff --git a/include/linux/nvhost.h b/include/linux/nvhost.h index faa183d40d6d..82bb884dfbbd 100644 --- a/include/linux/nvhost.h +++ b/include/linux/nvhost.h @@ -32,6 +32,12 @@ struct nvhost_master; #define NVHOST_MODULE_MAX_POWERGATE_IDS 2 #define NVHOST_MODULE_NO_POWERGATE_IDS .powergate_ids = {-1, -1} #define NVHOST_DEFAULT_CLOCKGATE_DELAY .clockgate_delay = 25 +#define NVHOST_NAME_SIZE 24 + +struct nvhost_device_id { + char name[NVHOST_NAME_SIZE]; + unsigned long driver_data; +}; struct nvhost_clock { char *name; @@ -46,7 +52,11 @@ enum nvhost_device_powerstate_t { }; struct nvhost_device { - const char *name; /* Device name */ + /* device name: its format is of type - + * <name><ip-version>.<instance> + * e.g.: gr3d01 = gr3d ip version 01 used in tegra2 + * no instance number means hardware supports single instance */ + const char *name; struct device dev; /* Linux device struct */ int id; /* Separates clients of same hw */ int index; /* Hardware channel number */ @@ -82,24 +92,6 @@ struct nvhost_device { struct list_head client_list; /* List of clients and rate requests */ struct nvhost_channel *channel; /* Channel assigned for the module */ - - /* Allocates a context handler for the device */ - struct nvhost_hwctx_handler *(*alloc_hwctx_handler)(u32 syncpt, - u32 waitbase, struct nvhost_channel *ch); - /* Preparing for power off. Used for context save. */ - int (*prepare_poweroff)(struct nvhost_device *dev); - /* Finalize power on. Can be used for context restore. */ - void (*finalize_poweron)(struct nvhost_device *dev); - /* Device is busy. */ - void (*busy)(struct nvhost_device *); - /* Device is idle. */ - void (*idle)(struct nvhost_device *); - /* Device is going to be suspended */ - void (*suspend)(struct nvhost_device *); - /* Device is initialized */ - void (*init)(struct nvhost_device *dev); - /* Device is de-initialized. */ - void (*deinit)(struct nvhost_device *dev); }; /* Register device to nvhost bus */ @@ -111,12 +103,39 @@ extern void nvhost_device_unregister(struct nvhost_device *); extern struct bus_type nvhost_bus_type; struct nvhost_driver { - int (*probe)(struct nvhost_device *); + int (*probe)(struct nvhost_device *, struct nvhost_device_id *); int (*remove)(struct nvhost_device *); void (*shutdown)(struct nvhost_device *); int (*suspend)(struct nvhost_device *, pm_message_t state); int (*resume)(struct nvhost_device *); struct device_driver driver; + + struct nvhost_device_id *id_table; + + /* Finalize power on. Can be used for context restore. */ + void (*finalize_poweron)(struct nvhost_device *dev); + + /* Device is busy. */ + void (*busy)(struct nvhost_device *); + + /* Device is idle. */ + void (*idle)(struct nvhost_device *); + + /* Device is going to be suspended */ + void (*suspend_ndev)(struct nvhost_device *); + + /* Device is initialized */ + void (*init)(struct nvhost_device *dev); + + /* Device is de-initialized. */ + void (*deinit)(struct nvhost_device *dev); + + /* Preparing for power off. Used for context save. */ + int (*prepare_poweroff)(struct nvhost_device *dev); + + /* Allocates a context handler for the device */ + struct nvhost_hwctx_handler *(*alloc_hwctx_handler)(u32 syncpt, + u32 waitbase, struct nvhost_channel *ch); }; extern int nvhost_driver_register(struct nvhost_driver *); @@ -128,7 +147,7 @@ extern struct resource *nvhost_get_resource_byname(struct nvhost_device *, unsigned int, const char *); extern int nvhost_get_irq_byname(struct nvhost_device *, const char *); -#define to_nvhost_device(x) container_of((x), struct nvhost_device, dev) +#define to_nvhost_device(x) container_of((x), struct nvhost_device, dev) #define to_nvhost_driver(drv) (container_of((drv), struct nvhost_driver, \ driver)) |