Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpu: host1x: Remove second host1x driver

Remove second host1x driver, and bind tegra-drm to the new host1x
driver. The logic to parse device tree and track clients is moved
to drm.c.

Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: Thierry Reding <thierry.reding@avionic-design.de>
Tested-by: Thierry Reding <thierry.reding@avionic-design.de>
Tested-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>

authored by

Terje Bergstrom and committed by
Thierry Reding
692e6d7b c89c0ea6

+318 -343
+1 -1
drivers/gpu/host1x/Makefile
··· 13 13 ccflags-y += -Iinclude/drm 14 14 ccflags-$(CONFIG_DRM_TEGRA_DEBUG) += -DDEBUG 15 15 16 - host1x-$(CONFIG_DRM_TEGRA) += drm/drm.o drm/fb.o drm/dc.o drm/host1x.o 16 + host1x-$(CONFIG_DRM_TEGRA) += drm/drm.o drm/fb.o drm/dc.o 17 17 host1x-$(CONFIG_DRM_TEGRA) += drm/output.o drm/rgb.o drm/hdmi.o 18 18 obj-$(CONFIG_TEGRA_HOST1X) += host1x.o
+56 -2
drivers/gpu/host1x/dev.c
··· 32 32 #include "channel.h" 33 33 #include "debug.h" 34 34 #include "hw/host1x01.h" 35 + #include "host1x_client.h" 36 + 37 + void host1x_set_drm_data(struct device *dev, void *data) 38 + { 39 + struct host1x *host1x = dev_get_drvdata(dev); 40 + host1x->drm_data = data; 41 + } 42 + 43 + void *host1x_get_drm_data(struct device *dev) 44 + { 45 + struct host1x *host1x = dev_get_drvdata(dev); 46 + return host1x->drm_data; 47 + } 35 48 36 49 void host1x_sync_writel(struct host1x *host1x, u32 v, u32 r) 37 50 { ··· 163 150 164 151 host1x_debug_init(host); 165 152 153 + host1x_drm_alloc(pdev); 154 + 166 155 return 0; 167 156 168 157 fail_deinit_syncpt: ··· 183 168 return 0; 184 169 } 185 170 186 - static struct platform_driver platform_driver = { 171 + static struct platform_driver tegra_host1x_driver = { 187 172 .probe = host1x_probe, 188 173 .remove = __exit_p(host1x_remove), 189 174 .driver = { ··· 193 178 }, 194 179 }; 195 180 196 - module_platform_driver(platform_driver); 181 + static int __init tegra_host1x_init(void) 182 + { 183 + int err; 197 184 185 + err = platform_driver_register(&tegra_host1x_driver); 186 + if (err < 0) 187 + return err; 188 + 189 + #ifdef CONFIG_DRM_TEGRA 190 + err = platform_driver_register(&tegra_dc_driver); 191 + if (err < 0) 192 + goto unregister_host1x; 193 + 194 + err = platform_driver_register(&tegra_hdmi_driver); 195 + if (err < 0) 196 + goto unregister_dc; 197 + #endif 198 + 199 + return 0; 200 + 201 + #ifdef CONFIG_DRM_TEGRA 202 + unregister_dc: 203 + platform_driver_unregister(&tegra_dc_driver); 204 + unregister_host1x: 205 + platform_driver_unregister(&tegra_host1x_driver); 206 + return err; 207 + #endif 208 + } 209 + module_init(tegra_host1x_init); 210 + 211 + static void __exit tegra_host1x_exit(void) 212 + { 213 + #ifdef CONFIG_DRM_TEGRA 214 + platform_driver_unregister(&tegra_hdmi_driver); 215 + platform_driver_unregister(&tegra_dc_driver); 216 + #endif 217 + platform_driver_unregister(&tegra_host1x_driver); 218 + } 219 + module_exit(tegra_host1x_exit); 220 + 221 + MODULE_AUTHOR("Thierry Reding <thierry.reding@avionic-design.de>"); 198 222 MODULE_AUTHOR("Terje Bergstrom <tbergstrom@nvidia.com>"); 199 223 MODULE_DESCRIPTION("Host1x driver for Tegra products"); 200 224 MODULE_LICENSE("GPL");
+6
drivers/gpu/host1x/dev.h
··· 124 124 unsigned int num_allocated_channels; 125 125 126 126 struct dentry *debugfs; 127 + 128 + void *drm_data; 127 129 }; 128 130 129 131 void host1x_sync_writel(struct host1x *host1x, u32 r, u32 v); ··· 300 298 { 301 299 host->debug_op->show_mlocks(host, o); 302 300 } 301 + 302 + extern struct platform_driver tegra_hdmi_driver; 303 + extern struct platform_driver tegra_dc_driver; 304 + extern struct platform_driver tegra_gr2d_driver; 303 305 304 306 #endif
+1 -1
drivers/gpu/host1x/drm/Kconfig
··· 1 1 config DRM_TEGRA 2 - tristate "NVIDIA Tegra DRM" 2 + bool "NVIDIA Tegra DRM" 3 3 depends on DRM && OF 4 4 select DRM_KMS_HELPER 5 5 select DRM_GEM_CMA_HELPER
+3 -2
drivers/gpu/host1x/drm/dc.c
··· 16 16 17 17 #include "drm.h" 18 18 #include "dc.h" 19 + #include "host1x_client.h" 19 20 20 21 struct tegra_plane { 21 22 struct drm_plane base; ··· 1098 1097 1099 1098 static int tegra_dc_probe(struct platform_device *pdev) 1100 1099 { 1101 - struct host1x_drm *host1x = dev_get_drvdata(pdev->dev.parent); 1100 + struct host1x_drm *host1x = host1x_get_drm_data(pdev->dev.parent); 1102 1101 struct resource *regs; 1103 1102 struct tegra_dc *dc; 1104 1103 int err; ··· 1161 1160 1162 1161 static int tegra_dc_remove(struct platform_device *pdev) 1163 1162 { 1164 - struct host1x_drm *host1x = dev_get_drvdata(pdev->dev.parent); 1163 + struct host1x_drm *host1x = host1x_get_drm_data(pdev->dev.parent); 1165 1164 struct tegra_dc *dc = platform_get_drvdata(pdev); 1166 1165 int err; 1167 1166
+213 -3
drivers/gpu/host1x/drm/drm.c
··· 14 14 #include <linux/dma-mapping.h> 15 15 #include <asm/dma-iommu.h> 16 16 17 + #include "host1x_client.h" 17 18 #include "drm.h" 18 19 19 20 #define DRIVER_NAME "tegra" ··· 24 23 #define DRIVER_MINOR 0 25 24 #define DRIVER_PATCHLEVEL 0 26 25 27 - static int tegra_drm_load(struct drm_device *drm, unsigned long flags) 26 + struct host1x_drm_client { 27 + struct host1x_client *client; 28 + struct device_node *np; 29 + struct list_head list; 30 + }; 31 + 32 + static int host1x_add_drm_client(struct host1x_drm *host1x, 33 + struct device_node *np) 28 34 { 29 - struct device *dev = drm->dev; 35 + struct host1x_drm_client *client; 36 + 37 + client = kzalloc(sizeof(*client), GFP_KERNEL); 38 + if (!client) 39 + return -ENOMEM; 40 + 41 + INIT_LIST_HEAD(&client->list); 42 + client->np = of_node_get(np); 43 + 44 + list_add_tail(&client->list, &host1x->drm_clients); 45 + 46 + return 0; 47 + } 48 + 49 + static int host1x_activate_drm_client(struct host1x_drm *host1x, 50 + struct host1x_drm_client *drm, 51 + struct host1x_client *client) 52 + { 53 + mutex_lock(&host1x->drm_clients_lock); 54 + list_del_init(&drm->list); 55 + list_add_tail(&drm->list, &host1x->drm_active); 56 + drm->client = client; 57 + mutex_unlock(&host1x->drm_clients_lock); 58 + 59 + return 0; 60 + } 61 + 62 + static int host1x_remove_drm_client(struct host1x_drm *host1x, 63 + struct host1x_drm_client *client) 64 + { 65 + mutex_lock(&host1x->drm_clients_lock); 66 + list_del_init(&client->list); 67 + mutex_unlock(&host1x->drm_clients_lock); 68 + 69 + of_node_put(client->np); 70 + kfree(client); 71 + 72 + return 0; 73 + } 74 + 75 + static int host1x_parse_dt(struct host1x_drm *host1x) 76 + { 77 + static const char * const compat[] = { 78 + "nvidia,tegra20-dc", 79 + "nvidia,tegra20-hdmi", 80 + "nvidia,tegra30-dc", 81 + "nvidia,tegra30-hdmi", 82 + }; 83 + unsigned int i; 84 + int err; 85 + 86 + for (i = 0; i < ARRAY_SIZE(compat); i++) { 87 + struct device_node *np; 88 + 89 + for_each_child_of_node(host1x->dev->of_node, np) { 90 + if (of_device_is_compatible(np, compat[i]) && 91 + of_device_is_available(np)) { 92 + err = host1x_add_drm_client(host1x, np); 93 + if (err < 0) 94 + return err; 95 + } 96 + } 97 + } 98 + 99 + return 0; 100 + } 101 + 102 + int host1x_drm_alloc(struct platform_device *pdev) 103 + { 30 104 struct host1x_drm *host1x; 31 105 int err; 32 106 33 - host1x = dev_get_drvdata(dev); 107 + host1x = devm_kzalloc(&pdev->dev, sizeof(*host1x), GFP_KERNEL); 108 + if (!host1x) 109 + return -ENOMEM; 110 + 111 + mutex_init(&host1x->drm_clients_lock); 112 + INIT_LIST_HEAD(&host1x->drm_clients); 113 + INIT_LIST_HEAD(&host1x->drm_active); 114 + mutex_init(&host1x->clients_lock); 115 + INIT_LIST_HEAD(&host1x->clients); 116 + host1x->dev = &pdev->dev; 117 + 118 + err = host1x_parse_dt(host1x); 119 + if (err < 0) { 120 + dev_err(&pdev->dev, "failed to parse DT: %d\n", err); 121 + return err; 122 + } 123 + 124 + host1x_set_drm_data(&pdev->dev, host1x); 125 + 126 + return 0; 127 + } 128 + 129 + int host1x_drm_init(struct host1x_drm *host1x, struct drm_device *drm) 130 + { 131 + struct host1x_client *client; 132 + 133 + mutex_lock(&host1x->clients_lock); 134 + 135 + list_for_each_entry(client, &host1x->clients, list) { 136 + if (client->ops && client->ops->drm_init) { 137 + int err = client->ops->drm_init(client, drm); 138 + if (err < 0) { 139 + dev_err(host1x->dev, 140 + "DRM setup failed for %s: %d\n", 141 + dev_name(client->dev), err); 142 + return err; 143 + } 144 + } 145 + } 146 + 147 + mutex_unlock(&host1x->clients_lock); 148 + 149 + return 0; 150 + } 151 + 152 + int host1x_drm_exit(struct host1x_drm *host1x) 153 + { 154 + struct platform_device *pdev = to_platform_device(host1x->dev); 155 + struct host1x_client *client; 156 + 157 + if (!host1x->drm) 158 + return 0; 159 + 160 + mutex_lock(&host1x->clients_lock); 161 + 162 + list_for_each_entry_reverse(client, &host1x->clients, list) { 163 + if (client->ops && client->ops->drm_exit) { 164 + int err = client->ops->drm_exit(client); 165 + if (err < 0) { 166 + dev_err(host1x->dev, 167 + "DRM cleanup failed for %s: %d\n", 168 + dev_name(client->dev), err); 169 + return err; 170 + } 171 + } 172 + } 173 + 174 + mutex_unlock(&host1x->clients_lock); 175 + 176 + drm_platform_exit(&tegra_drm_driver, pdev); 177 + host1x->drm = NULL; 178 + 179 + return 0; 180 + } 181 + 182 + int host1x_register_client(struct host1x_drm *host1x, 183 + struct host1x_client *client) 184 + { 185 + struct host1x_drm_client *drm, *tmp; 186 + int err; 187 + 188 + mutex_lock(&host1x->clients_lock); 189 + list_add_tail(&client->list, &host1x->clients); 190 + mutex_unlock(&host1x->clients_lock); 191 + 192 + list_for_each_entry_safe(drm, tmp, &host1x->drm_clients, list) 193 + if (drm->np == client->dev->of_node) 194 + host1x_activate_drm_client(host1x, drm, client); 195 + 196 + if (list_empty(&host1x->drm_clients)) { 197 + struct platform_device *pdev = to_platform_device(host1x->dev); 198 + 199 + err = drm_platform_init(&tegra_drm_driver, pdev); 200 + if (err < 0) { 201 + dev_err(host1x->dev, "drm_platform_init(): %d\n", err); 202 + return err; 203 + } 204 + } 205 + 206 + return 0; 207 + } 208 + 209 + int host1x_unregister_client(struct host1x_drm *host1x, 210 + struct host1x_client *client) 211 + { 212 + struct host1x_drm_client *drm, *tmp; 213 + int err; 214 + 215 + list_for_each_entry_safe(drm, tmp, &host1x->drm_active, list) { 216 + if (drm->client == client) { 217 + err = host1x_drm_exit(host1x); 218 + if (err < 0) { 219 + dev_err(host1x->dev, "host1x_drm_exit(): %d\n", 220 + err); 221 + return err; 222 + } 223 + 224 + host1x_remove_drm_client(host1x, drm); 225 + break; 226 + } 227 + } 228 + 229 + mutex_lock(&host1x->clients_lock); 230 + list_del_init(&client->list); 231 + mutex_unlock(&host1x->clients_lock); 232 + 233 + return 0; 234 + } 235 + 236 + static int tegra_drm_load(struct drm_device *drm, unsigned long flags) 237 + { 238 + struct host1x_drm *host1x; 239 + int err; 240 + 241 + host1x = host1x_get_drm_data(drm->dev); 34 242 drm->dev_private = host1x; 35 243 host1x->drm = drm; 36 244
-3
drivers/gpu/host1x/drm/drm.h
··· 229 229 extern int tegra_drm_fb_init(struct drm_device *drm); 230 230 extern void tegra_drm_fb_exit(struct drm_device *drm); 231 231 232 - extern struct platform_driver tegra_host1x_driver; 233 - extern struct platform_driver tegra_hdmi_driver; 234 - extern struct platform_driver tegra_dc_driver; 235 232 extern struct drm_driver tegra_drm_driver; 236 233 237 234 #endif /* HOST1X_DRM_H */
+3 -2
drivers/gpu/host1x/drm/hdmi.c
··· 22 22 #include "hdmi.h" 23 23 #include "drm.h" 24 24 #include "dc.h" 25 + #include "host1x_client.h" 25 26 26 27 struct tegra_hdmi { 27 28 struct host1x_client client; ··· 1190 1189 1191 1190 static int tegra_hdmi_probe(struct platform_device *pdev) 1192 1191 { 1193 - struct host1x_drm *host1x = dev_get_drvdata(pdev->dev.parent); 1192 + struct host1x_drm *host1x = host1x_get_drm_data(pdev->dev.parent); 1194 1193 struct tegra_hdmi *hdmi; 1195 1194 struct resource *regs; 1196 1195 int err; ··· 1279 1278 1280 1279 static int tegra_hdmi_remove(struct platform_device *pdev) 1281 1280 { 1282 - struct host1x_drm *host1x = dev_get_drvdata(pdev->dev.parent); 1281 + struct host1x_drm *host1x = host1x_get_drm_data(pdev->dev.parent); 1283 1282 struct tegra_hdmi *hdmi = platform_get_drvdata(pdev); 1284 1283 int err; 1285 1284
-329
drivers/gpu/host1x/drm/host1x.c
··· 1 - /* 2 - * Copyright (C) 2012 Avionic Design GmbH 3 - * Copyright (C) 2012 NVIDIA CORPORATION. All rights reserved. 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 - 10 - #include <linux/clk.h> 11 - #include <linux/err.h> 12 - #include <linux/module.h> 13 - #include <linux/of.h> 14 - #include <linux/platform_device.h> 15 - 16 - #include "drm.h" 17 - 18 - struct host1x_drm_client { 19 - struct host1x_client *client; 20 - struct device_node *np; 21 - struct list_head list; 22 - }; 23 - 24 - static int host1x_add_drm_client(struct host1x_drm *host1x, 25 - struct device_node *np) 26 - { 27 - struct host1x_drm_client *client; 28 - 29 - client = kzalloc(sizeof(*client), GFP_KERNEL); 30 - if (!client) 31 - return -ENOMEM; 32 - 33 - INIT_LIST_HEAD(&client->list); 34 - client->np = of_node_get(np); 35 - 36 - list_add_tail(&client->list, &host1x->drm_clients); 37 - 38 - return 0; 39 - } 40 - 41 - static int host1x_activate_drm_client(struct host1x_drm *host1x, 42 - struct host1x_drm_client *drm, 43 - struct host1x_client *client) 44 - { 45 - mutex_lock(&host1x->drm_clients_lock); 46 - list_del_init(&drm->list); 47 - list_add_tail(&drm->list, &host1x->drm_active); 48 - drm->client = client; 49 - mutex_unlock(&host1x->drm_clients_lock); 50 - 51 - return 0; 52 - } 53 - 54 - static int host1x_remove_drm_client(struct host1x_drm *host1x, 55 - struct host1x_drm_client *client) 56 - { 57 - mutex_lock(&host1x->drm_clients_lock); 58 - list_del_init(&client->list); 59 - mutex_unlock(&host1x->drm_clients_lock); 60 - 61 - of_node_put(client->np); 62 - kfree(client); 63 - 64 - return 0; 65 - } 66 - 67 - static int host1x_parse_dt(struct host1x_drm *host1x) 68 - { 69 - static const char * const compat[] = { 70 - "nvidia,tegra20-dc", 71 - "nvidia,tegra20-hdmi", 72 - "nvidia,tegra30-dc", 73 - "nvidia,tegra30-hdmi", 74 - }; 75 - unsigned int i; 76 - int err; 77 - 78 - for (i = 0; i < ARRAY_SIZE(compat); i++) { 79 - struct device_node *np; 80 - 81 - for_each_child_of_node(host1x->dev->of_node, np) { 82 - if (of_device_is_compatible(np, compat[i]) && 83 - of_device_is_available(np)) { 84 - err = host1x_add_drm_client(host1x, np); 85 - if (err < 0) 86 - return err; 87 - } 88 - } 89 - } 90 - 91 - return 0; 92 - } 93 - 94 - static int tegra_host1x_probe(struct platform_device *pdev) 95 - { 96 - struct host1x_drm *host1x; 97 - struct resource *regs; 98 - int err; 99 - 100 - host1x = devm_kzalloc(&pdev->dev, sizeof(*host1x), GFP_KERNEL); 101 - if (!host1x) 102 - return -ENOMEM; 103 - 104 - mutex_init(&host1x->drm_clients_lock); 105 - INIT_LIST_HEAD(&host1x->drm_clients); 106 - INIT_LIST_HEAD(&host1x->drm_active); 107 - mutex_init(&host1x->clients_lock); 108 - INIT_LIST_HEAD(&host1x->clients); 109 - host1x->dev = &pdev->dev; 110 - 111 - err = host1x_parse_dt(host1x); 112 - if (err < 0) { 113 - dev_err(&pdev->dev, "failed to parse DT: %d\n", err); 114 - return err; 115 - } 116 - 117 - host1x->clk = devm_clk_get(&pdev->dev, NULL); 118 - if (IS_ERR(host1x->clk)) 119 - return PTR_ERR(host1x->clk); 120 - 121 - err = clk_prepare_enable(host1x->clk); 122 - if (err < 0) 123 - return err; 124 - 125 - regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); 126 - if (!regs) { 127 - err = -ENXIO; 128 - goto err; 129 - } 130 - 131 - err = platform_get_irq(pdev, 0); 132 - if (err < 0) 133 - goto err; 134 - 135 - host1x->syncpt = err; 136 - 137 - err = platform_get_irq(pdev, 1); 138 - if (err < 0) 139 - goto err; 140 - 141 - host1x->irq = err; 142 - 143 - host1x->regs = devm_ioremap_resource(&pdev->dev, regs); 144 - if (IS_ERR(host1x->regs)) { 145 - err = PTR_ERR(host1x->regs); 146 - goto err; 147 - } 148 - 149 - platform_set_drvdata(pdev, host1x); 150 - 151 - return 0; 152 - 153 - err: 154 - clk_disable_unprepare(host1x->clk); 155 - return err; 156 - } 157 - 158 - static int tegra_host1x_remove(struct platform_device *pdev) 159 - { 160 - struct host1x_drm *host1x = platform_get_drvdata(pdev); 161 - 162 - clk_disable_unprepare(host1x->clk); 163 - 164 - return 0; 165 - } 166 - 167 - int host1x_drm_init(struct host1x_drm *host1x, struct drm_device *drm) 168 - { 169 - struct host1x_client *client; 170 - 171 - mutex_lock(&host1x->clients_lock); 172 - 173 - list_for_each_entry(client, &host1x->clients, list) { 174 - if (client->ops && client->ops->drm_init) { 175 - int err = client->ops->drm_init(client, drm); 176 - if (err < 0) { 177 - dev_err(host1x->dev, 178 - "DRM setup failed for %s: %d\n", 179 - dev_name(client->dev), err); 180 - return err; 181 - } 182 - } 183 - } 184 - 185 - mutex_unlock(&host1x->clients_lock); 186 - 187 - return 0; 188 - } 189 - 190 - int host1x_drm_exit(struct host1x_drm *host1x) 191 - { 192 - struct platform_device *pdev = to_platform_device(host1x->dev); 193 - struct host1x_client *client; 194 - 195 - if (!host1x->drm) 196 - return 0; 197 - 198 - mutex_lock(&host1x->clients_lock); 199 - 200 - list_for_each_entry_reverse(client, &host1x->clients, list) { 201 - if (client->ops && client->ops->drm_exit) { 202 - int err = client->ops->drm_exit(client); 203 - if (err < 0) { 204 - dev_err(host1x->dev, 205 - "DRM cleanup failed for %s: %d\n", 206 - dev_name(client->dev), err); 207 - return err; 208 - } 209 - } 210 - } 211 - 212 - mutex_unlock(&host1x->clients_lock); 213 - 214 - drm_platform_exit(&tegra_drm_driver, pdev); 215 - host1x->drm = NULL; 216 - 217 - return 0; 218 - } 219 - 220 - int host1x_register_client(struct host1x_drm *host1x, 221 - struct host1x_client *client) 222 - { 223 - struct host1x_drm_client *drm, *tmp; 224 - int err; 225 - 226 - mutex_lock(&host1x->clients_lock); 227 - list_add_tail(&client->list, &host1x->clients); 228 - mutex_unlock(&host1x->clients_lock); 229 - 230 - list_for_each_entry_safe(drm, tmp, &host1x->drm_clients, list) 231 - if (drm->np == client->dev->of_node) 232 - host1x_activate_drm_client(host1x, drm, client); 233 - 234 - if (list_empty(&host1x->drm_clients)) { 235 - struct platform_device *pdev = to_platform_device(host1x->dev); 236 - 237 - err = drm_platform_init(&tegra_drm_driver, pdev); 238 - if (err < 0) { 239 - dev_err(host1x->dev, "drm_platform_init(): %d\n", err); 240 - return err; 241 - } 242 - } 243 - 244 - client->host1x = host1x; 245 - 246 - return 0; 247 - } 248 - 249 - int host1x_unregister_client(struct host1x_drm *host1x, 250 - struct host1x_client *client) 251 - { 252 - struct host1x_drm_client *drm, *tmp; 253 - int err; 254 - 255 - list_for_each_entry_safe(drm, tmp, &host1x->drm_active, list) { 256 - if (drm->client == client) { 257 - err = host1x_drm_exit(host1x); 258 - if (err < 0) { 259 - dev_err(host1x->dev, "host1x_drm_exit(): %d\n", 260 - err); 261 - return err; 262 - } 263 - 264 - host1x_remove_drm_client(host1x, drm); 265 - break; 266 - } 267 - } 268 - 269 - mutex_lock(&host1x->clients_lock); 270 - list_del_init(&client->list); 271 - mutex_unlock(&host1x->clients_lock); 272 - 273 - return 0; 274 - } 275 - 276 - static struct of_device_id tegra_host1x_of_match[] = { 277 - { .compatible = "nvidia,tegra30-host1x", }, 278 - { .compatible = "nvidia,tegra20-host1x", }, 279 - { }, 280 - }; 281 - MODULE_DEVICE_TABLE(of, tegra_host1x_of_match); 282 - 283 - struct platform_driver tegra_host1x_driver = { 284 - .driver = { 285 - .name = "tegra-host1x", 286 - .owner = THIS_MODULE, 287 - .of_match_table = tegra_host1x_of_match, 288 - }, 289 - .probe = tegra_host1x_probe, 290 - .remove = tegra_host1x_remove, 291 - }; 292 - 293 - static int __init tegra_host1x_init(void) 294 - { 295 - int err; 296 - 297 - err = platform_driver_register(&tegra_host1x_driver); 298 - if (err < 0) 299 - return err; 300 - 301 - err = platform_driver_register(&tegra_dc_driver); 302 - if (err < 0) 303 - goto unregister_host1x; 304 - 305 - err = platform_driver_register(&tegra_hdmi_driver); 306 - if (err < 0) 307 - goto unregister_dc; 308 - 309 - return 0; 310 - 311 - unregister_dc: 312 - platform_driver_unregister(&tegra_dc_driver); 313 - unregister_host1x: 314 - platform_driver_unregister(&tegra_host1x_driver); 315 - return err; 316 - } 317 - module_init(tegra_host1x_init); 318 - 319 - static void __exit tegra_host1x_exit(void) 320 - { 321 - platform_driver_unregister(&tegra_hdmi_driver); 322 - platform_driver_unregister(&tegra_dc_driver); 323 - platform_driver_unregister(&tegra_host1x_driver); 324 - } 325 - module_exit(tegra_host1x_exit); 326 - 327 - MODULE_AUTHOR("Thierry Reding <thierry.reding@avionic-design.de>"); 328 - MODULE_DESCRIPTION("NVIDIA Tegra DRM driver"); 329 - MODULE_LICENSE("GPL");
+35
drivers/gpu/host1x/host1x_client.h
··· 1 + /* 2 + * Copyright (c) 2013, NVIDIA Corporation. 3 + * 4 + * This program is free software; you can redistribute it and/or modify it 5 + * under the terms and conditions of the GNU General Public License, 6 + * version 2, as published by the Free Software Foundation. 7 + * 8 + * This program is distributed in the hope it will be useful, but WITHOUT 9 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 + * more details. 12 + * 13 + * You should have received a copy of the GNU General Public License 14 + * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 + */ 16 + 17 + #ifndef HOST1X_CLIENT_H 18 + #define HOST1X_CLIENT_H 19 + 20 + struct device; 21 + struct platform_device; 22 + 23 + #ifdef CONFIG_DRM_TEGRA 24 + int host1x_drm_alloc(struct platform_device *pdev); 25 + #else 26 + static inline int host1x_drm_alloc(struct platform_device *pdev) 27 + { 28 + return 0; 29 + } 30 + #endif 31 + 32 + void host1x_set_drm_data(struct device *dev, void *data); 33 + void *host1x_get_drm_data(struct device *dev); 34 + 35 + #endif