Thierry Reding | d8f4a9e | 2012-11-15 21:28:22 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 Avionic Design GmbH |
Terje Bergstrom | d43f81c | 2013-03-22 16:34:09 +0200 | [diff] [blame] | 3 | * Copyright (C) 2012-2013 NVIDIA CORPORATION. All rights reserved. |
Thierry Reding | d8f4a9e | 2012-11-15 21:28:22 +0000 | [diff] [blame] | 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License version 2 as |
| 7 | * published by the Free Software Foundation. |
| 8 | */ |
| 9 | |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 10 | #include "host1x_client.h" |
Arto Merilainen | de2ba66 | 2013-03-22 16:34:08 +0200 | [diff] [blame] | 11 | #include "dev.h" |
Thierry Reding | d8f4a9e | 2012-11-15 21:28:22 +0000 | [diff] [blame] | 12 | #include "drm.h" |
Arto Merilainen | de2ba66 | 2013-03-22 16:34:08 +0200 | [diff] [blame] | 13 | #include "gem.h" |
| 14 | #include "syncpt.h" |
Thierry Reding | d8f4a9e | 2012-11-15 21:28:22 +0000 | [diff] [blame] | 15 | |
| 16 | #define DRIVER_NAME "tegra" |
| 17 | #define DRIVER_DESC "NVIDIA Tegra graphics" |
| 18 | #define DRIVER_DATE "20120330" |
| 19 | #define DRIVER_MAJOR 0 |
| 20 | #define DRIVER_MINOR 0 |
| 21 | #define DRIVER_PATCHLEVEL 0 |
| 22 | |
Thierry Reding | 08943e6 | 2013-09-26 16:08:18 +0200 | [diff] [blame] | 23 | struct tegra_drm_file { |
| 24 | struct list_head contexts; |
| 25 | }; |
| 26 | |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 27 | struct host1x_subdev { |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 28 | struct host1x_client *client; |
| 29 | struct device_node *np; |
| 30 | struct list_head list; |
| 31 | }; |
| 32 | |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 33 | static int host1x_subdev_add(struct tegra_drm *tegra, struct device_node *np) |
Thierry Reding | d8f4a9e | 2012-11-15 21:28:22 +0000 | [diff] [blame] | 34 | { |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 35 | struct host1x_subdev *subdev; |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 36 | |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 37 | subdev = kzalloc(sizeof(*subdev), GFP_KERNEL); |
| 38 | if (!subdev) |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 39 | return -ENOMEM; |
| 40 | |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 41 | INIT_LIST_HEAD(&subdev->list); |
| 42 | subdev->np = of_node_get(np); |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 43 | |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 44 | list_add_tail(&subdev->list, &tegra->subdevs); |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 45 | |
| 46 | return 0; |
| 47 | } |
| 48 | |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 49 | static int host1x_subdev_register(struct tegra_drm *tegra, |
| 50 | struct host1x_subdev *subdev, |
| 51 | struct host1x_client *client) |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 52 | { |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 53 | mutex_lock(&tegra->subdevs_lock); |
| 54 | list_del_init(&subdev->list); |
| 55 | list_add_tail(&subdev->list, &tegra->active); |
| 56 | subdev->client = client; |
| 57 | mutex_unlock(&tegra->subdevs_lock); |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 58 | |
| 59 | return 0; |
| 60 | } |
| 61 | |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 62 | static int host1x_subdev_unregister(struct tegra_drm *tegra, |
| 63 | struct host1x_subdev *subdev) |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 64 | { |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 65 | mutex_lock(&tegra->subdevs_lock); |
| 66 | list_del_init(&subdev->list); |
| 67 | mutex_unlock(&tegra->subdevs_lock); |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 68 | |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 69 | of_node_put(subdev->np); |
| 70 | kfree(subdev); |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 71 | |
| 72 | return 0; |
| 73 | } |
| 74 | |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 75 | static int tegra_parse_dt(struct tegra_drm *tegra) |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 76 | { |
| 77 | static const char * const compat[] = { |
| 78 | "nvidia,tegra20-dc", |
| 79 | "nvidia,tegra20-hdmi", |
Terje Bergstrom | d43f81c | 2013-03-22 16:34:09 +0200 | [diff] [blame] | 80 | "nvidia,tegra20-gr2d", |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 81 | "nvidia,tegra30-dc", |
| 82 | "nvidia,tegra30-hdmi", |
Terje Bergstrom | d43f81c | 2013-03-22 16:34:09 +0200 | [diff] [blame] | 83 | "nvidia,tegra30-gr2d", |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 84 | }; |
| 85 | unsigned int i; |
| 86 | int err; |
| 87 | |
| 88 | for (i = 0; i < ARRAY_SIZE(compat); i++) { |
| 89 | struct device_node *np; |
| 90 | |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 91 | for_each_child_of_node(tegra->dev->of_node, np) { |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 92 | if (of_device_is_compatible(np, compat[i]) && |
| 93 | of_device_is_available(np)) { |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 94 | err = host1x_subdev_add(tegra, np); |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 95 | if (err < 0) |
| 96 | return err; |
| 97 | } |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | return 0; |
| 102 | } |
| 103 | |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 104 | int tegra_drm_alloc(struct platform_device *pdev) |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 105 | { |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 106 | struct tegra_drm *tegra; |
Thierry Reding | d8f4a9e | 2012-11-15 21:28:22 +0000 | [diff] [blame] | 107 | int err; |
| 108 | |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 109 | tegra = devm_kzalloc(&pdev->dev, sizeof(*tegra), GFP_KERNEL); |
| 110 | if (!tegra) |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 111 | return -ENOMEM; |
| 112 | |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 113 | mutex_init(&tegra->subdevs_lock); |
| 114 | INIT_LIST_HEAD(&tegra->subdevs); |
| 115 | INIT_LIST_HEAD(&tegra->active); |
| 116 | mutex_init(&tegra->clients_lock); |
| 117 | INIT_LIST_HEAD(&tegra->clients); |
| 118 | tegra->dev = &pdev->dev; |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 119 | |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 120 | err = tegra_parse_dt(tegra); |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 121 | if (err < 0) { |
| 122 | dev_err(&pdev->dev, "failed to parse DT: %d\n", err); |
| 123 | return err; |
| 124 | } |
| 125 | |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 126 | host1x_set_drm_data(&pdev->dev, tegra); |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 127 | |
| 128 | return 0; |
| 129 | } |
| 130 | |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 131 | int tegra_drm_init(struct tegra_drm *tegra, struct drm_device *drm) |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 132 | { |
| 133 | struct host1x_client *client; |
Thierry Reding | 53fa7f7 | 2013-09-24 15:35:40 +0200 | [diff] [blame^] | 134 | int err; |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 135 | |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 136 | mutex_lock(&tegra->clients_lock); |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 137 | |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 138 | list_for_each_entry(client, &tegra->clients, list) { |
Thierry Reding | 53fa7f7 | 2013-09-24 15:35:40 +0200 | [diff] [blame^] | 139 | struct tegra_drm_client *tdc = to_tegra_drm_client(client); |
| 140 | |
| 141 | /* associate client with DRM device */ |
| 142 | tdc->drm = drm; |
| 143 | |
| 144 | if (client->ops && client->ops->init) { |
| 145 | err = client->ops->init(client); |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 146 | if (err < 0) { |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 147 | dev_err(tegra->dev, |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 148 | "DRM setup failed for %s: %d\n", |
| 149 | dev_name(client->dev), err); |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 150 | mutex_unlock(&tegra->clients_lock); |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 151 | return err; |
| 152 | } |
| 153 | } |
| 154 | } |
| 155 | |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 156 | mutex_unlock(&tegra->clients_lock); |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 157 | |
| 158 | return 0; |
| 159 | } |
| 160 | |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 161 | int tegra_drm_exit(struct tegra_drm *tegra) |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 162 | { |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 163 | struct host1x_client *client; |
Thierry Reding | 53fa7f7 | 2013-09-24 15:35:40 +0200 | [diff] [blame^] | 164 | struct platform_device *pdev; |
| 165 | int err; |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 166 | |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 167 | if (!tegra->drm) |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 168 | return 0; |
| 169 | |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 170 | mutex_lock(&tegra->clients_lock); |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 171 | |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 172 | list_for_each_entry_reverse(client, &tegra->clients, list) { |
Thierry Reding | 53fa7f7 | 2013-09-24 15:35:40 +0200 | [diff] [blame^] | 173 | if (client->ops && client->ops->exit) { |
| 174 | err = client->ops->exit(client); |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 175 | if (err < 0) { |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 176 | dev_err(tegra->dev, |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 177 | "DRM cleanup failed for %s: %d\n", |
| 178 | dev_name(client->dev), err); |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 179 | mutex_unlock(&tegra->clients_lock); |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 180 | return err; |
| 181 | } |
| 182 | } |
| 183 | } |
| 184 | |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 185 | mutex_unlock(&tegra->clients_lock); |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 186 | |
Thierry Reding | 53fa7f7 | 2013-09-24 15:35:40 +0200 | [diff] [blame^] | 187 | pdev = to_platform_device(tegra->dev); |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 188 | drm_platform_exit(&tegra_drm_driver, pdev); |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 189 | tegra->drm = NULL; |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 190 | |
| 191 | return 0; |
| 192 | } |
| 193 | |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 194 | int host1x_register_client(struct tegra_drm *tegra, |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 195 | struct host1x_client *client) |
| 196 | { |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 197 | struct host1x_subdev *subdev, *tmp; |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 198 | int err; |
| 199 | |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 200 | mutex_lock(&tegra->clients_lock); |
| 201 | list_add_tail(&client->list, &tegra->clients); |
| 202 | mutex_unlock(&tegra->clients_lock); |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 203 | |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 204 | list_for_each_entry_safe(subdev, tmp, &tegra->subdevs, list) |
| 205 | if (subdev->np == client->dev->of_node) |
| 206 | host1x_subdev_register(tegra, subdev, client); |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 207 | |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 208 | if (list_empty(&tegra->subdevs)) { |
| 209 | struct platform_device *pdev = to_platform_device(tegra->dev); |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 210 | |
| 211 | err = drm_platform_init(&tegra_drm_driver, pdev); |
| 212 | if (err < 0) { |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 213 | dev_err(tegra->dev, "drm_platform_init(): %d\n", err); |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 214 | return err; |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | return 0; |
| 219 | } |
| 220 | |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 221 | int host1x_unregister_client(struct tegra_drm *tegra, |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 222 | struct host1x_client *client) |
| 223 | { |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 224 | struct host1x_subdev *subdev, *tmp; |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 225 | int err; |
| 226 | |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 227 | list_for_each_entry_safe(subdev, tmp, &tegra->active, list) { |
| 228 | if (subdev->client == client) { |
| 229 | err = tegra_drm_exit(tegra); |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 230 | if (err < 0) { |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 231 | dev_err(tegra->dev, "tegra_drm_exit(): %d\n", |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 232 | err); |
| 233 | return err; |
| 234 | } |
| 235 | |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 236 | host1x_subdev_unregister(tegra, subdev); |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 237 | break; |
| 238 | } |
| 239 | } |
| 240 | |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 241 | mutex_lock(&tegra->clients_lock); |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 242 | list_del_init(&client->list); |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 243 | mutex_unlock(&tegra->clients_lock); |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 244 | |
| 245 | return 0; |
| 246 | } |
| 247 | |
| 248 | static int tegra_drm_load(struct drm_device *drm, unsigned long flags) |
| 249 | { |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 250 | struct tegra_drm *tegra; |
Terje Bergstrom | 692e6d7 | 2013-03-22 16:34:07 +0200 | [diff] [blame] | 251 | int err; |
| 252 | |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 253 | tegra = host1x_get_drm_data(drm->dev); |
| 254 | drm->dev_private = tegra; |
| 255 | tegra->drm = drm; |
Thierry Reding | d8f4a9e | 2012-11-15 21:28:22 +0000 | [diff] [blame] | 256 | |
| 257 | drm_mode_config_init(drm); |
| 258 | |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 259 | err = tegra_drm_init(tegra, drm); |
Thierry Reding | d8f4a9e | 2012-11-15 21:28:22 +0000 | [diff] [blame] | 260 | if (err < 0) |
| 261 | return err; |
| 262 | |
Thierry Reding | 603f0cc | 2013-04-22 21:22:14 +0200 | [diff] [blame] | 263 | /* |
| 264 | * We don't use the drm_irq_install() helpers provided by the DRM |
| 265 | * core, so we need to set this manually in order to allow the |
| 266 | * DRM_IOCTL_WAIT_VBLANK to operate correctly. |
| 267 | */ |
Ville Syrjälä | 4423843 | 2013-10-04 14:53:37 +0300 | [diff] [blame] | 268 | drm->irq_enabled = true; |
Thierry Reding | 603f0cc | 2013-04-22 21:22:14 +0200 | [diff] [blame] | 269 | |
Thierry Reding | 6e5ff99 | 2012-11-28 11:45:47 +0100 | [diff] [blame] | 270 | err = drm_vblank_init(drm, drm->mode_config.num_crtc); |
| 271 | if (err < 0) |
| 272 | return err; |
| 273 | |
Thierry Reding | d8f4a9e | 2012-11-15 21:28:22 +0000 | [diff] [blame] | 274 | err = tegra_drm_fb_init(drm); |
| 275 | if (err < 0) |
| 276 | return err; |
| 277 | |
| 278 | drm_kms_helper_poll_init(drm); |
| 279 | |
| 280 | return 0; |
| 281 | } |
| 282 | |
| 283 | static int tegra_drm_unload(struct drm_device *drm) |
| 284 | { |
| 285 | drm_kms_helper_poll_fini(drm); |
| 286 | tegra_drm_fb_exit(drm); |
| 287 | |
| 288 | drm_mode_config_cleanup(drm); |
| 289 | |
| 290 | return 0; |
| 291 | } |
| 292 | |
| 293 | static int tegra_drm_open(struct drm_device *drm, struct drm_file *filp) |
| 294 | { |
Thierry Reding | 08943e6 | 2013-09-26 16:08:18 +0200 | [diff] [blame] | 295 | struct tegra_drm_file *fpriv; |
Terje Bergstrom | d43f81c | 2013-03-22 16:34:09 +0200 | [diff] [blame] | 296 | |
| 297 | fpriv = kzalloc(sizeof(*fpriv), GFP_KERNEL); |
| 298 | if (!fpriv) |
| 299 | return -ENOMEM; |
| 300 | |
| 301 | INIT_LIST_HEAD(&fpriv->contexts); |
| 302 | filp->driver_priv = fpriv; |
| 303 | |
Thierry Reding | d8f4a9e | 2012-11-15 21:28:22 +0000 | [diff] [blame] | 304 | return 0; |
| 305 | } |
| 306 | |
Thierry Reding | c88c363 | 2013-09-26 16:08:22 +0200 | [diff] [blame] | 307 | static void tegra_drm_context_free(struct tegra_drm_context *context) |
Terje Bergstrom | d43f81c | 2013-03-22 16:34:09 +0200 | [diff] [blame] | 308 | { |
| 309 | context->client->ops->close_channel(context); |
| 310 | kfree(context); |
| 311 | } |
| 312 | |
Thierry Reding | d8f4a9e | 2012-11-15 21:28:22 +0000 | [diff] [blame] | 313 | static void tegra_drm_lastclose(struct drm_device *drm) |
| 314 | { |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 315 | struct tegra_drm *tegra = drm->dev_private; |
Thierry Reding | d8f4a9e | 2012-11-15 21:28:22 +0000 | [diff] [blame] | 316 | |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 317 | tegra_fbdev_restore_mode(tegra->fbdev); |
Thierry Reding | d8f4a9e | 2012-11-15 21:28:22 +0000 | [diff] [blame] | 318 | } |
| 319 | |
Terje Bergstrom | d43f81c | 2013-03-22 16:34:09 +0200 | [diff] [blame] | 320 | #ifdef CONFIG_DRM_TEGRA_STAGING |
Thierry Reding | c88c363 | 2013-09-26 16:08:22 +0200 | [diff] [blame] | 321 | static struct tegra_drm_context *tegra_drm_get_context(__u64 context) |
Terje Bergstrom | d43f81c | 2013-03-22 16:34:09 +0200 | [diff] [blame] | 322 | { |
Thierry Reding | c88c363 | 2013-09-26 16:08:22 +0200 | [diff] [blame] | 323 | return (struct tegra_drm_context *)(uintptr_t)context; |
| 324 | } |
| 325 | |
| 326 | static bool tegra_drm_file_owns_context(struct tegra_drm_file *file, |
| 327 | struct tegra_drm_context *context) |
| 328 | { |
| 329 | struct tegra_drm_context *ctx; |
Terje Bergstrom | d43f81c | 2013-03-22 16:34:09 +0200 | [diff] [blame] | 330 | |
| 331 | list_for_each_entry(ctx, &file->contexts, list) |
| 332 | if (ctx == context) |
| 333 | return true; |
| 334 | |
| 335 | return false; |
| 336 | } |
| 337 | |
| 338 | static int tegra_gem_create(struct drm_device *drm, void *data, |
| 339 | struct drm_file *file) |
| 340 | { |
| 341 | struct drm_tegra_gem_create *args = data; |
| 342 | struct tegra_bo *bo; |
| 343 | |
| 344 | bo = tegra_bo_create_with_handle(file, drm, args->size, |
| 345 | &args->handle); |
| 346 | if (IS_ERR(bo)) |
| 347 | return PTR_ERR(bo); |
| 348 | |
| 349 | return 0; |
| 350 | } |
| 351 | |
| 352 | static int tegra_gem_mmap(struct drm_device *drm, void *data, |
| 353 | struct drm_file *file) |
| 354 | { |
| 355 | struct drm_tegra_gem_mmap *args = data; |
| 356 | struct drm_gem_object *gem; |
| 357 | struct tegra_bo *bo; |
| 358 | |
| 359 | gem = drm_gem_object_lookup(drm, file, args->handle); |
| 360 | if (!gem) |
| 361 | return -EINVAL; |
| 362 | |
| 363 | bo = to_tegra_bo(gem); |
| 364 | |
David Herrmann | 2bc7b0c | 2013-08-13 14:19:58 +0200 | [diff] [blame] | 365 | args->offset = drm_vma_node_offset_addr(&bo->gem.vma_node); |
Terje Bergstrom | d43f81c | 2013-03-22 16:34:09 +0200 | [diff] [blame] | 366 | |
| 367 | drm_gem_object_unreference(gem); |
| 368 | |
| 369 | return 0; |
| 370 | } |
| 371 | |
| 372 | static int tegra_syncpt_read(struct drm_device *drm, void *data, |
| 373 | struct drm_file *file) |
| 374 | { |
| 375 | struct drm_tegra_syncpt_read *args = data; |
| 376 | struct host1x *host = dev_get_drvdata(drm->dev); |
| 377 | struct host1x_syncpt *sp = host1x_syncpt_get(host, args->id); |
| 378 | |
| 379 | if (!sp) |
| 380 | return -EINVAL; |
| 381 | |
| 382 | args->value = host1x_syncpt_read_min(sp); |
| 383 | return 0; |
| 384 | } |
| 385 | |
| 386 | static int tegra_syncpt_incr(struct drm_device *drm, void *data, |
| 387 | struct drm_file *file) |
| 388 | { |
| 389 | struct drm_tegra_syncpt_incr *args = data; |
| 390 | struct host1x *host = dev_get_drvdata(drm->dev); |
| 391 | struct host1x_syncpt *sp = host1x_syncpt_get(host, args->id); |
| 392 | |
| 393 | if (!sp) |
| 394 | return -EINVAL; |
| 395 | |
Arto Merilainen | ebae30b | 2013-05-29 13:26:08 +0300 | [diff] [blame] | 396 | return host1x_syncpt_incr(sp); |
Terje Bergstrom | d43f81c | 2013-03-22 16:34:09 +0200 | [diff] [blame] | 397 | } |
| 398 | |
| 399 | static int tegra_syncpt_wait(struct drm_device *drm, void *data, |
| 400 | struct drm_file *file) |
| 401 | { |
| 402 | struct drm_tegra_syncpt_wait *args = data; |
| 403 | struct host1x *host = dev_get_drvdata(drm->dev); |
| 404 | struct host1x_syncpt *sp = host1x_syncpt_get(host, args->id); |
| 405 | |
| 406 | if (!sp) |
| 407 | return -EINVAL; |
| 408 | |
| 409 | return host1x_syncpt_wait(sp, args->thresh, args->timeout, |
| 410 | &args->value); |
| 411 | } |
| 412 | |
| 413 | static int tegra_open_channel(struct drm_device *drm, void *data, |
| 414 | struct drm_file *file) |
| 415 | { |
Thierry Reding | 08943e6 | 2013-09-26 16:08:18 +0200 | [diff] [blame] | 416 | struct tegra_drm_file *fpriv = file->driver_priv; |
Thierry Reding | 386a2a7 | 2013-09-24 13:22:17 +0200 | [diff] [blame] | 417 | struct tegra_drm *tegra = drm->dev_private; |
| 418 | struct drm_tegra_open_channel *args = data; |
Thierry Reding | c88c363 | 2013-09-26 16:08:22 +0200 | [diff] [blame] | 419 | struct tegra_drm_context *context; |
Thierry Reding | 53fa7f7 | 2013-09-24 15:35:40 +0200 | [diff] [blame^] | 420 | struct tegra_drm_client *client; |
Terje Bergstrom | d43f81c | 2013-03-22 16:34:09 +0200 | [diff] [blame] | 421 | int err = -ENODEV; |
| 422 | |
| 423 | context = kzalloc(sizeof(*context), GFP_KERNEL); |
| 424 | if (!context) |
| 425 | return -ENOMEM; |
| 426 | |
Thierry Reding | 53fa7f7 | 2013-09-24 15:35:40 +0200 | [diff] [blame^] | 427 | list_for_each_entry(client, &tegra->clients, base.list) |
| 428 | if (client->base.class == args->client) { |
Terje Bergstrom | d43f81c | 2013-03-22 16:34:09 +0200 | [diff] [blame] | 429 | err = client->ops->open_channel(client, context); |
| 430 | if (err) |
| 431 | break; |
| 432 | |
Terje Bergstrom | d43f81c | 2013-03-22 16:34:09 +0200 | [diff] [blame] | 433 | list_add(&context->list, &fpriv->contexts); |
| 434 | args->context = (uintptr_t)context; |
Thierry Reding | 53fa7f7 | 2013-09-24 15:35:40 +0200 | [diff] [blame^] | 435 | context->client = client; |
Terje Bergstrom | d43f81c | 2013-03-22 16:34:09 +0200 | [diff] [blame] | 436 | return 0; |
| 437 | } |
| 438 | |
| 439 | kfree(context); |
| 440 | return err; |
| 441 | } |
| 442 | |
| 443 | static int tegra_close_channel(struct drm_device *drm, void *data, |
| 444 | struct drm_file *file) |
| 445 | { |
| 446 | struct drm_tegra_close_channel *args = data; |
Thierry Reding | 08943e6 | 2013-09-26 16:08:18 +0200 | [diff] [blame] | 447 | struct tegra_drm_file *fpriv = file->driver_priv; |
Thierry Reding | c88c363 | 2013-09-26 16:08:22 +0200 | [diff] [blame] | 448 | struct tegra_drm_context *context; |
| 449 | |
| 450 | context = tegra_drm_get_context(args->context); |
Terje Bergstrom | d43f81c | 2013-03-22 16:34:09 +0200 | [diff] [blame] | 451 | |
Thierry Reding | 08943e6 | 2013-09-26 16:08:18 +0200 | [diff] [blame] | 452 | if (!tegra_drm_file_owns_context(fpriv, context)) |
Terje Bergstrom | d43f81c | 2013-03-22 16:34:09 +0200 | [diff] [blame] | 453 | return -EINVAL; |
| 454 | |
| 455 | list_del(&context->list); |
Thierry Reding | c88c363 | 2013-09-26 16:08:22 +0200 | [diff] [blame] | 456 | tegra_drm_context_free(context); |
Terje Bergstrom | d43f81c | 2013-03-22 16:34:09 +0200 | [diff] [blame] | 457 | |
| 458 | return 0; |
| 459 | } |
| 460 | |
| 461 | static int tegra_get_syncpt(struct drm_device *drm, void *data, |
| 462 | struct drm_file *file) |
| 463 | { |
Thierry Reding | 08943e6 | 2013-09-26 16:08:18 +0200 | [diff] [blame] | 464 | struct tegra_drm_file *fpriv = file->driver_priv; |
Terje Bergstrom | d43f81c | 2013-03-22 16:34:09 +0200 | [diff] [blame] | 465 | struct drm_tegra_get_syncpt *args = data; |
Thierry Reding | c88c363 | 2013-09-26 16:08:22 +0200 | [diff] [blame] | 466 | struct tegra_drm_context *context; |
Terje Bergstrom | d43f81c | 2013-03-22 16:34:09 +0200 | [diff] [blame] | 467 | struct host1x_syncpt *syncpt; |
| 468 | |
Thierry Reding | c88c363 | 2013-09-26 16:08:22 +0200 | [diff] [blame] | 469 | context = tegra_drm_get_context(args->context); |
| 470 | |
Thierry Reding | 08943e6 | 2013-09-26 16:08:18 +0200 | [diff] [blame] | 471 | if (!tegra_drm_file_owns_context(fpriv, context)) |
Terje Bergstrom | d43f81c | 2013-03-22 16:34:09 +0200 | [diff] [blame] | 472 | return -ENODEV; |
| 473 | |
Thierry Reding | 53fa7f7 | 2013-09-24 15:35:40 +0200 | [diff] [blame^] | 474 | if (args->index >= context->client->base.num_syncpts) |
Terje Bergstrom | d43f81c | 2013-03-22 16:34:09 +0200 | [diff] [blame] | 475 | return -EINVAL; |
| 476 | |
Thierry Reding | 53fa7f7 | 2013-09-24 15:35:40 +0200 | [diff] [blame^] | 477 | syncpt = context->client->base.syncpts[args->index]; |
Terje Bergstrom | d43f81c | 2013-03-22 16:34:09 +0200 | [diff] [blame] | 478 | args->id = host1x_syncpt_id(syncpt); |
| 479 | |
| 480 | return 0; |
| 481 | } |
| 482 | |
| 483 | static int tegra_submit(struct drm_device *drm, void *data, |
| 484 | struct drm_file *file) |
| 485 | { |
Thierry Reding | 08943e6 | 2013-09-26 16:08:18 +0200 | [diff] [blame] | 486 | struct tegra_drm_file *fpriv = file->driver_priv; |
Terje Bergstrom | d43f81c | 2013-03-22 16:34:09 +0200 | [diff] [blame] | 487 | struct drm_tegra_submit *args = data; |
Thierry Reding | c88c363 | 2013-09-26 16:08:22 +0200 | [diff] [blame] | 488 | struct tegra_drm_context *context; |
| 489 | |
| 490 | context = tegra_drm_get_context(args->context); |
Terje Bergstrom | d43f81c | 2013-03-22 16:34:09 +0200 | [diff] [blame] | 491 | |
Thierry Reding | 08943e6 | 2013-09-26 16:08:18 +0200 | [diff] [blame] | 492 | if (!tegra_drm_file_owns_context(fpriv, context)) |
Terje Bergstrom | d43f81c | 2013-03-22 16:34:09 +0200 | [diff] [blame] | 493 | return -ENODEV; |
| 494 | |
| 495 | return context->client->ops->submit(context, args, drm, file); |
| 496 | } |
| 497 | #endif |
| 498 | |
Rob Clark | baa7094 | 2013-08-02 13:27:49 -0400 | [diff] [blame] | 499 | static const struct drm_ioctl_desc tegra_drm_ioctls[] = { |
Terje Bergstrom | d43f81c | 2013-03-22 16:34:09 +0200 | [diff] [blame] | 500 | #ifdef CONFIG_DRM_TEGRA_STAGING |
| 501 | DRM_IOCTL_DEF_DRV(TEGRA_GEM_CREATE, tegra_gem_create, DRM_UNLOCKED | DRM_AUTH), |
| 502 | DRM_IOCTL_DEF_DRV(TEGRA_GEM_MMAP, tegra_gem_mmap, DRM_UNLOCKED), |
| 503 | DRM_IOCTL_DEF_DRV(TEGRA_SYNCPT_READ, tegra_syncpt_read, DRM_UNLOCKED), |
| 504 | DRM_IOCTL_DEF_DRV(TEGRA_SYNCPT_INCR, tegra_syncpt_incr, DRM_UNLOCKED), |
| 505 | DRM_IOCTL_DEF_DRV(TEGRA_SYNCPT_WAIT, tegra_syncpt_wait, DRM_UNLOCKED), |
| 506 | DRM_IOCTL_DEF_DRV(TEGRA_OPEN_CHANNEL, tegra_open_channel, DRM_UNLOCKED), |
| 507 | DRM_IOCTL_DEF_DRV(TEGRA_CLOSE_CHANNEL, tegra_close_channel, DRM_UNLOCKED), |
| 508 | DRM_IOCTL_DEF_DRV(TEGRA_GET_SYNCPT, tegra_get_syncpt, DRM_UNLOCKED), |
| 509 | DRM_IOCTL_DEF_DRV(TEGRA_SUBMIT, tegra_submit, DRM_UNLOCKED), |
| 510 | #endif |
Thierry Reding | d8f4a9e | 2012-11-15 21:28:22 +0000 | [diff] [blame] | 511 | }; |
| 512 | |
| 513 | static const struct file_operations tegra_drm_fops = { |
| 514 | .owner = THIS_MODULE, |
| 515 | .open = drm_open, |
| 516 | .release = drm_release, |
| 517 | .unlocked_ioctl = drm_ioctl, |
Arto Merilainen | de2ba66 | 2013-03-22 16:34:08 +0200 | [diff] [blame] | 518 | .mmap = tegra_drm_mmap, |
Thierry Reding | d8f4a9e | 2012-11-15 21:28:22 +0000 | [diff] [blame] | 519 | .poll = drm_poll, |
Thierry Reding | d8f4a9e | 2012-11-15 21:28:22 +0000 | [diff] [blame] | 520 | .read = drm_read, |
| 521 | #ifdef CONFIG_COMPAT |
| 522 | .compat_ioctl = drm_compat_ioctl, |
| 523 | #endif |
| 524 | .llseek = noop_llseek, |
| 525 | }; |
| 526 | |
Thierry Reding | 6e5ff99 | 2012-11-28 11:45:47 +0100 | [diff] [blame] | 527 | static struct drm_crtc *tegra_crtc_from_pipe(struct drm_device *drm, int pipe) |
| 528 | { |
| 529 | struct drm_crtc *crtc; |
| 530 | |
| 531 | list_for_each_entry(crtc, &drm->mode_config.crtc_list, head) { |
| 532 | struct tegra_dc *dc = to_tegra_dc(crtc); |
| 533 | |
| 534 | if (dc->pipe == pipe) |
| 535 | return crtc; |
| 536 | } |
| 537 | |
| 538 | return NULL; |
| 539 | } |
| 540 | |
| 541 | static u32 tegra_drm_get_vblank_counter(struct drm_device *dev, int crtc) |
| 542 | { |
| 543 | /* TODO: implement real hardware counter using syncpoints */ |
| 544 | return drm_vblank_count(dev, crtc); |
| 545 | } |
| 546 | |
| 547 | static int tegra_drm_enable_vblank(struct drm_device *drm, int pipe) |
| 548 | { |
| 549 | struct drm_crtc *crtc = tegra_crtc_from_pipe(drm, pipe); |
| 550 | struct tegra_dc *dc = to_tegra_dc(crtc); |
| 551 | |
| 552 | if (!crtc) |
| 553 | return -ENODEV; |
| 554 | |
| 555 | tegra_dc_enable_vblank(dc); |
| 556 | |
| 557 | return 0; |
| 558 | } |
| 559 | |
| 560 | static void tegra_drm_disable_vblank(struct drm_device *drm, int pipe) |
| 561 | { |
| 562 | struct drm_crtc *crtc = tegra_crtc_from_pipe(drm, pipe); |
| 563 | struct tegra_dc *dc = to_tegra_dc(crtc); |
| 564 | |
| 565 | if (crtc) |
| 566 | tegra_dc_disable_vblank(dc); |
| 567 | } |
| 568 | |
Thierry Reding | 3c03c46 | 2012-11-28 12:00:18 +0100 | [diff] [blame] | 569 | static void tegra_drm_preclose(struct drm_device *drm, struct drm_file *file) |
| 570 | { |
Thierry Reding | 08943e6 | 2013-09-26 16:08:18 +0200 | [diff] [blame] | 571 | struct tegra_drm_file *fpriv = file->driver_priv; |
Thierry Reding | c88c363 | 2013-09-26 16:08:22 +0200 | [diff] [blame] | 572 | struct tegra_drm_context *context, *tmp; |
Thierry Reding | 3c03c46 | 2012-11-28 12:00:18 +0100 | [diff] [blame] | 573 | struct drm_crtc *crtc; |
| 574 | |
| 575 | list_for_each_entry(crtc, &drm->mode_config.crtc_list, head) |
| 576 | tegra_dc_cancel_page_flip(crtc, file); |
Terje Bergstrom | d43f81c | 2013-03-22 16:34:09 +0200 | [diff] [blame] | 577 | |
| 578 | list_for_each_entry_safe(context, tmp, &fpriv->contexts, list) |
Thierry Reding | c88c363 | 2013-09-26 16:08:22 +0200 | [diff] [blame] | 579 | tegra_drm_context_free(context); |
Terje Bergstrom | d43f81c | 2013-03-22 16:34:09 +0200 | [diff] [blame] | 580 | |
| 581 | kfree(fpriv); |
Thierry Reding | 3c03c46 | 2012-11-28 12:00:18 +0100 | [diff] [blame] | 582 | } |
| 583 | |
Thierry Reding | e450fcc | 2013-02-13 16:13:16 +0100 | [diff] [blame] | 584 | #ifdef CONFIG_DEBUG_FS |
| 585 | static int tegra_debugfs_framebuffers(struct seq_file *s, void *data) |
| 586 | { |
| 587 | struct drm_info_node *node = (struct drm_info_node *)s->private; |
| 588 | struct drm_device *drm = node->minor->dev; |
| 589 | struct drm_framebuffer *fb; |
| 590 | |
| 591 | mutex_lock(&drm->mode_config.fb_lock); |
| 592 | |
| 593 | list_for_each_entry(fb, &drm->mode_config.fb_list, head) { |
| 594 | seq_printf(s, "%3d: user size: %d x %d, depth %d, %d bpp, refcount %d\n", |
| 595 | fb->base.id, fb->width, fb->height, fb->depth, |
| 596 | fb->bits_per_pixel, |
| 597 | atomic_read(&fb->refcount.refcount)); |
| 598 | } |
| 599 | |
| 600 | mutex_unlock(&drm->mode_config.fb_lock); |
| 601 | |
| 602 | return 0; |
| 603 | } |
| 604 | |
| 605 | static struct drm_info_list tegra_debugfs_list[] = { |
| 606 | { "framebuffers", tegra_debugfs_framebuffers, 0 }, |
| 607 | }; |
| 608 | |
| 609 | static int tegra_debugfs_init(struct drm_minor *minor) |
| 610 | { |
| 611 | return drm_debugfs_create_files(tegra_debugfs_list, |
| 612 | ARRAY_SIZE(tegra_debugfs_list), |
| 613 | minor->debugfs_root, minor); |
| 614 | } |
| 615 | |
| 616 | static void tegra_debugfs_cleanup(struct drm_minor *minor) |
| 617 | { |
| 618 | drm_debugfs_remove_files(tegra_debugfs_list, |
| 619 | ARRAY_SIZE(tegra_debugfs_list), minor); |
| 620 | } |
| 621 | #endif |
| 622 | |
Thierry Reding | d8f4a9e | 2012-11-15 21:28:22 +0000 | [diff] [blame] | 623 | struct drm_driver tegra_drm_driver = { |
Laurent Pinchart | 604faa7 | 2013-05-29 07:44:34 +0200 | [diff] [blame] | 624 | .driver_features = DRIVER_MODESET | DRIVER_GEM, |
Thierry Reding | d8f4a9e | 2012-11-15 21:28:22 +0000 | [diff] [blame] | 625 | .load = tegra_drm_load, |
| 626 | .unload = tegra_drm_unload, |
| 627 | .open = tegra_drm_open, |
Thierry Reding | 3c03c46 | 2012-11-28 12:00:18 +0100 | [diff] [blame] | 628 | .preclose = tegra_drm_preclose, |
Thierry Reding | d8f4a9e | 2012-11-15 21:28:22 +0000 | [diff] [blame] | 629 | .lastclose = tegra_drm_lastclose, |
| 630 | |
Thierry Reding | 6e5ff99 | 2012-11-28 11:45:47 +0100 | [diff] [blame] | 631 | .get_vblank_counter = tegra_drm_get_vblank_counter, |
| 632 | .enable_vblank = tegra_drm_enable_vblank, |
| 633 | .disable_vblank = tegra_drm_disable_vblank, |
| 634 | |
Thierry Reding | e450fcc | 2013-02-13 16:13:16 +0100 | [diff] [blame] | 635 | #if defined(CONFIG_DEBUG_FS) |
| 636 | .debugfs_init = tegra_debugfs_init, |
| 637 | .debugfs_cleanup = tegra_debugfs_cleanup, |
| 638 | #endif |
| 639 | |
Arto Merilainen | de2ba66 | 2013-03-22 16:34:08 +0200 | [diff] [blame] | 640 | .gem_free_object = tegra_bo_free_object, |
| 641 | .gem_vm_ops = &tegra_bo_vm_ops, |
| 642 | .dumb_create = tegra_bo_dumb_create, |
| 643 | .dumb_map_offset = tegra_bo_dumb_map_offset, |
Daniel Vetter | 43387b3 | 2013-07-16 09:12:04 +0200 | [diff] [blame] | 644 | .dumb_destroy = drm_gem_dumb_destroy, |
Thierry Reding | d8f4a9e | 2012-11-15 21:28:22 +0000 | [diff] [blame] | 645 | |
| 646 | .ioctls = tegra_drm_ioctls, |
| 647 | .num_ioctls = ARRAY_SIZE(tegra_drm_ioctls), |
| 648 | .fops = &tegra_drm_fops, |
| 649 | |
| 650 | .name = DRIVER_NAME, |
| 651 | .desc = DRIVER_DESC, |
| 652 | .date = DRIVER_DATE, |
| 653 | .major = DRIVER_MAJOR, |
| 654 | .minor = DRIVER_MINOR, |
| 655 | .patchlevel = DRIVER_PATCHLEVEL, |
| 656 | }; |