2 * Copyright (C) 2013 NVIDIA Corporation
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
11 static int drm_host1x_set_busid(struct drm_device *dev,
12 struct drm_master *master)
14 const char *device = dev_name(dev->dev);
15 const char *bus = dev->dev->bus->name;
17 master->unique_len = strlen(bus) + 1 + strlen(device);
18 master->unique_size = master->unique_len;
20 master->unique = kmalloc(master->unique_len + 1, GFP_KERNEL);
24 snprintf(master->unique, master->unique_len + 1, "%s:%s", bus, device);
29 static struct drm_bus drm_host1x_bus = {
30 .bus_type = DRIVER_BUS_HOST1X,
31 .set_busid = drm_host1x_set_busid,
34 int drm_host1x_init(struct drm_driver *driver, struct host1x_device *device)
36 struct drm_device *drm;
39 driver->bus = &drm_host1x_bus;
41 drm = drm_dev_alloc(driver, &device->dev);
45 ret = drm_dev_register(drm, 0);
49 DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", driver->name,
50 driver->major, driver->minor, driver->patchlevel,
51 driver->date, drm->primary->index);
60 void drm_host1x_exit(struct drm_driver *driver, struct host1x_device *device)
62 struct tegra_drm *tegra = dev_get_drvdata(&device->dev);
64 drm_put_dev(tegra->drm);