diff options
Diffstat (limited to 'drivers/video/tegra/host/mpe/mpe.c')
-rw-r--r-- | drivers/video/tegra/host/mpe/mpe.c | 53 |
1 files changed, 48 insertions, 5 deletions
diff --git a/drivers/video/tegra/host/mpe/mpe.c b/drivers/video/tegra/host/mpe/mpe.c index f155183613cd..d8c9da7e9a76 100644 --- a/drivers/video/tegra/host/mpe/mpe.c +++ b/drivers/video/tegra/host/mpe/mpe.c @@ -31,6 +31,7 @@ #include <linux/resource.h> #include <mach/iomap.h> +#include <mach/hardware.h> #include "bus_client.h" @@ -533,9 +534,8 @@ static void ctxmpe_save_service(struct nvhost_hwctx *nctx) h->syncpt); } -struct nvhost_hwctx_handler *nvhost_mpe_ctxhandler_init( - u32 syncpt, u32 waitbase, - struct nvhost_channel *ch) +struct nvhost_hwctx_handler *nvhost_mpe_ctxhandler_init(u32 syncpt, + u32 waitbase, struct nvhost_channel *ch) { struct nvmap_client *nvmap; u32 *save_ptr; @@ -585,9 +585,51 @@ int nvhost_mpe_prepare_power_off(struct nvhost_device *dev) return host1x_save_context(dev, NVSYNCPT_MPE); } -static int __devinit mpe_probe(struct nvhost_device *dev) +enum mpe_ip_ver { + mpe_01, + mpe_02, +}; + +struct mpe_desc { + int (*prepare_poweroff)(struct nvhost_device *dev); + struct nvhost_hwctx_handler *(*alloc_hwctx_handler)(u32 syncpt, + u32 waitbase, struct nvhost_channel *ch); +}; + +static const struct mpe_desc mpe[] = { + [mpe_01] = { + .prepare_poweroff = nvhost_mpe_prepare_power_off, + .alloc_hwctx_handler = nvhost_mpe_ctxhandler_init, + }, + [mpe_02] = { + .prepare_poweroff = nvhost_mpe_prepare_power_off, + .alloc_hwctx_handler = nvhost_mpe_ctxhandler_init, + }, +}; + +static struct nvhost_device_id mpe_id[] = { + { "mpe01", mpe_01 }, + { "mpe02", mpe_02 }, + { }, +}; + +MODULE_DEVICE_TABLE(nvhost, mpe_id); + +static int __devinit mpe_probe(struct nvhost_device *dev, + struct nvhost_device_id *id_table) { int err = 0; + int index = 0; + struct nvhost_driver *drv = to_nvhost_driver(dev->dev.driver); + + index = id_table->driver_data; + + drv->prepare_poweroff = mpe[index].prepare_poweroff; + drv->alloc_hwctx_handler = mpe[index].alloc_hwctx_handler; + + /* reset device name so that consistent device name can be + * found in clock tree */ + dev->name = "mpe"; err = nvhost_client_device_get_resources(dev); if (err) @@ -632,7 +674,8 @@ static struct nvhost_driver mpe_driver = { .driver = { .owner = THIS_MODULE, .name = "mpe", - } + }, + .id_table = mpe_id, }; static int __init mpe_init(void) |