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 *driver
= dev
->driver
->name
;
16 const char *bus
= dev
->dev
->bus
->name
;
19 master
->unique_len
= strlen(bus
) + 1 + strlen(device
);
20 master
->unique_size
= master
->unique_len
;
22 master
->unique
= kmalloc(master
->unique_len
+ 1, GFP_KERNEL
);
26 snprintf(master
->unique
, master
->unique_len
+ 1, "%s:%s", bus
, device
);
28 length
= strlen(driver
) + 1 + master
->unique_len
;
30 dev
->devname
= kmalloc(length
+ 1, GFP_KERNEL
);
34 snprintf(dev
->devname
, length
+ 1, "%s@%s", driver
, master
->unique
);
39 static struct drm_bus drm_host1x_bus
= {
40 .bus_type
= DRIVER_BUS_HOST1X
,
41 .set_busid
= drm_host1x_set_busid
,
44 int drm_host1x_init(struct drm_driver
*driver
, struct host1x_device
*device
)
46 struct drm_device
*drm
;
49 driver
->bus
= &drm_host1x_bus
;
51 drm
= drm_dev_alloc(driver
, &device
->dev
);
55 ret
= drm_dev_register(drm
, 0);
59 DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", driver
->name
,
60 driver
->major
, driver
->minor
, driver
->patchlevel
,
61 driver
->date
, drm
->primary
->index
);
70 void drm_host1x_exit(struct drm_driver
*driver
, struct host1x_device
*device
)
72 struct tegra_drm
*tegra
= dev_get_drvdata(&device
->dev
);
74 drm_put_dev(tegra
->drm
);