aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2014-05-22 03:57:15 -0400
committerThierry Reding <treding@nvidia.com>2014-06-05 17:14:46 -0400
commit9910f5c455de10f0eb2559093a7adad65f6c05cd (patch)
treed1858225e96d9861c43900141dcf09a08e8f82c0
parentb528ae7190867cd079bae5d6cf48c17d673428ae (diff)
drm/tegra: Remove host1x drm_bus implementation
The DRM core can now cope with drivers that don't have an associated struct drm_bus, so the host1x implementation is no longer useful. Signed-off-by: Thierry Reding <treding@nvidia.com>
-rw-r--r--drivers/gpu/drm/tegra/Makefile1
-rw-r--r--drivers/gpu/drm/tegra/bus.c64
-rw-r--r--drivers/gpu/drm/tegra/dc.c10
-rw-r--r--drivers/gpu/drm/tegra/drm.c35
-rw-r--r--drivers/gpu/drm/tegra/drm.h4
-rw-r--r--drivers/gpu/drm/tegra/dsi.c6
-rw-r--r--drivers/gpu/drm/tegra/gr2d.c8
-rw-r--r--drivers/gpu/drm/tegra/gr3d.c8
-rw-r--r--drivers/gpu/drm/tegra/hdmi.c6
-rw-r--r--drivers/gpu/drm/tegra/sor.c6
10 files changed, 52 insertions, 96 deletions
diff --git a/drivers/gpu/drm/tegra/Makefile b/drivers/gpu/drm/tegra/Makefile
index d43f21bb4596..2c66a8db9da4 100644
--- a/drivers/gpu/drm/tegra/Makefile
+++ b/drivers/gpu/drm/tegra/Makefile
@@ -1,7 +1,6 @@
1ccflags-$(CONFIG_DRM_TEGRA_DEBUG) += -DDEBUG 1ccflags-$(CONFIG_DRM_TEGRA_DEBUG) += -DDEBUG
2 2
3tegra-drm-y := \ 3tegra-drm-y := \
4 bus.o \
5 drm.o \ 4 drm.o \
6 gem.o \ 5 gem.o \
7 fb.o \ 6 fb.o \
diff --git a/drivers/gpu/drm/tegra/bus.c b/drivers/gpu/drm/tegra/bus.c
deleted file mode 100644
index b3a66d65cb53..000000000000
--- a/drivers/gpu/drm/tegra/bus.c
+++ /dev/null
@@ -1,64 +0,0 @@
1/*
2 * Copyright (C) 2013 NVIDIA Corporation
3 *
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.
7 */
8
9#include "drm.h"
10
11static int drm_host1x_set_busid(struct drm_device *dev,
12 struct drm_master *master)
13{
14 const char *device = dev_name(dev->dev);
15 const char *bus = dev->dev->bus->name;
16
17 master->unique_len = strlen(bus) + 1 + strlen(device);
18 master->unique_size = master->unique_len;
19
20 master->unique = kmalloc(master->unique_len + 1, GFP_KERNEL);
21 if (!master->unique)
22 return -ENOMEM;
23
24 snprintf(master->unique, master->unique_len + 1, "%s:%s", bus, device);
25
26 return 0;
27}
28
29static struct drm_bus drm_host1x_bus = {
30 .set_busid = drm_host1x_set_busid,
31};
32
33int drm_host1x_init(struct drm_driver *driver, struct host1x_device *device)
34{
35 struct drm_device *drm;
36 int ret;
37
38 driver->bus = &drm_host1x_bus;
39
40 drm = drm_dev_alloc(driver, &device->dev);
41 if (!drm)
42 return -ENOMEM;
43
44 ret = drm_dev_register(drm, 0);
45 if (ret)
46 goto err_free;
47
48 DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", driver->name,
49 driver->major, driver->minor, driver->patchlevel,
50 driver->date, drm->primary->index);
51
52 return 0;
53
54err_free:
55 drm_dev_unref(drm);
56 return ret;
57}
58
59void drm_host1x_exit(struct drm_driver *driver, struct host1x_device *device)
60{
61 struct tegra_drm *tegra = dev_get_drvdata(&device->dev);
62
63 drm_put_dev(tegra->drm);
64}
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
index 859e424e15e5..323216789b69 100644
--- a/drivers/gpu/drm/tegra/dc.c
+++ b/drivers/gpu/drm/tegra/dc.c
@@ -1104,26 +1104,26 @@ static int tegra_dc_debugfs_exit(struct tegra_dc *dc)
1104 1104
1105static int tegra_dc_init(struct host1x_client *client) 1105static int tegra_dc_init(struct host1x_client *client)
1106{ 1106{
1107 struct tegra_drm *tegra = dev_get_drvdata(client->parent); 1107 struct drm_device *drm = dev_get_drvdata(client->parent);
1108 struct tegra_dc *dc = host1x_client_to_dc(client); 1108 struct tegra_dc *dc = host1x_client_to_dc(client);
1109 int err; 1109 int err;
1110 1110
1111 drm_crtc_init(tegra->drm, &dc->base, &tegra_crtc_funcs); 1111 drm_crtc_init(drm, &dc->base, &tegra_crtc_funcs);
1112 drm_mode_crtc_set_gamma_size(&dc->base, 256); 1112 drm_mode_crtc_set_gamma_size(&dc->base, 256);
1113 drm_crtc_helper_add(&dc->base, &tegra_crtc_helper_funcs); 1113 drm_crtc_helper_add(&dc->base, &tegra_crtc_helper_funcs);
1114 1114
1115 err = tegra_dc_rgb_init(tegra->drm, dc); 1115 err = tegra_dc_rgb_init(drm, dc);
1116 if (err < 0 && err != -ENODEV) { 1116 if (err < 0 && err != -ENODEV) {
1117 dev_err(dc->dev, "failed to initialize RGB output: %d\n", err); 1117 dev_err(dc->dev, "failed to initialize RGB output: %d\n", err);
1118 return err; 1118 return err;
1119 } 1119 }
1120 1120
1121 err = tegra_dc_add_planes(tegra->drm, dc); 1121 err = tegra_dc_add_planes(drm, dc);
1122 if (err < 0) 1122 if (err < 0)
1123 return err; 1123 return err;
1124 1124
1125 if (IS_ENABLED(CONFIG_DEBUG_FS)) { 1125 if (IS_ENABLED(CONFIG_DEBUG_FS)) {
1126 err = tegra_dc_debugfs_init(dc, tegra->drm->primary); 1126 err = tegra_dc_debugfs_init(dc, drm->primary);
1127 if (err < 0) 1127 if (err < 0)
1128 dev_err(dc->dev, "debugfs setup failed: %d\n", err); 1128 dev_err(dc->dev, "debugfs setup failed: %d\n", err);
1129 } 1129 }
diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index 09ee77923d67..3396f9f6a9f7 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -33,7 +33,6 @@ static int tegra_drm_load(struct drm_device *drm, unsigned long flags)
33 if (!tegra) 33 if (!tegra)
34 return -ENOMEM; 34 return -ENOMEM;
35 35
36 dev_set_drvdata(drm->dev, tegra);
37 mutex_init(&tegra->clients_lock); 36 mutex_init(&tegra->clients_lock);
38 INIT_LIST_HEAD(&tegra->clients); 37 INIT_LIST_HEAD(&tegra->clients);
39 drm->dev_private = tegra; 38 drm->dev_private = tegra;
@@ -640,14 +639,40 @@ int tegra_drm_unregister_client(struct tegra_drm *tegra,
640 return 0; 639 return 0;
641} 640}
642 641
643static int host1x_drm_probe(struct host1x_device *device) 642static int host1x_drm_probe(struct host1x_device *dev)
644{ 643{
645 return drm_host1x_init(&tegra_drm_driver, device); 644 struct drm_driver *driver = &tegra_drm_driver;
645 struct drm_device *drm;
646 int err;
647
648 drm = drm_dev_alloc(driver, &dev->dev);
649 if (!drm)
650 return -ENOMEM;
651
652 drm_dev_set_unique(drm, dev_name(&dev->dev));
653 dev_set_drvdata(&dev->dev, drm);
654
655 err = drm_dev_register(drm, 0);
656 if (err < 0)
657 goto unref;
658
659 DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", driver->name,
660 driver->major, driver->minor, driver->patchlevel,
661 driver->date, drm->primary->index);
662
663 return 0;
664
665unref:
666 drm_dev_unref(drm);
667 return err;
646} 668}
647 669
648static int host1x_drm_remove(struct host1x_device *device) 670static int host1x_drm_remove(struct host1x_device *dev)
649{ 671{
650 drm_host1x_exit(&tegra_drm_driver, device); 672 struct drm_device *drm = dev_get_drvdata(&dev->dev);
673
674 drm_dev_unregister(drm);
675 drm_dev_unref(drm);
651 676
652 return 0; 677 return 0;
653} 678}
diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h
index 784fd5c77441..6b8fe9d86ed4 100644
--- a/drivers/gpu/drm/tegra/drm.h
+++ b/drivers/gpu/drm/tegra/drm.h
@@ -249,10 +249,6 @@ static inline int tegra_output_check_mode(struct tegra_output *output,
249 return output ? -ENOSYS : -EINVAL; 249 return output ? -ENOSYS : -EINVAL;
250} 250}
251 251
252/* from bus.c */
253int drm_host1x_init(struct drm_driver *driver, struct host1x_device *device);
254void drm_host1x_exit(struct drm_driver *driver, struct host1x_device *device);
255
256/* from rgb.c */ 252/* from rgb.c */
257int tegra_dc_rgb_probe(struct tegra_dc *dc); 253int tegra_dc_rgb_probe(struct tegra_dc *dc);
258int tegra_dc_rgb_remove(struct tegra_dc *dc); 254int tegra_dc_rgb_remove(struct tegra_dc *dc);
diff --git a/drivers/gpu/drm/tegra/dsi.c b/drivers/gpu/drm/tegra/dsi.c
index 3838575f71c6..bd56f2affa78 100644
--- a/drivers/gpu/drm/tegra/dsi.c
+++ b/drivers/gpu/drm/tegra/dsi.c
@@ -715,7 +715,7 @@ static int tegra_dsi_pad_calibrate(struct tegra_dsi *dsi)
715 715
716static int tegra_dsi_init(struct host1x_client *client) 716static int tegra_dsi_init(struct host1x_client *client)
717{ 717{
718 struct tegra_drm *tegra = dev_get_drvdata(client->parent); 718 struct drm_device *drm = dev_get_drvdata(client->parent);
719 struct tegra_dsi *dsi = host1x_client_to_dsi(client); 719 struct tegra_dsi *dsi = host1x_client_to_dsi(client);
720 int err; 720 int err;
721 721
@@ -723,14 +723,14 @@ static int tegra_dsi_init(struct host1x_client *client)
723 dsi->output.dev = client->dev; 723 dsi->output.dev = client->dev;
724 dsi->output.ops = &dsi_ops; 724 dsi->output.ops = &dsi_ops;
725 725
726 err = tegra_output_init(tegra->drm, &dsi->output); 726 err = tegra_output_init(drm, &dsi->output);
727 if (err < 0) { 727 if (err < 0) {
728 dev_err(client->dev, "output setup failed: %d\n", err); 728 dev_err(client->dev, "output setup failed: %d\n", err);
729 return err; 729 return err;
730 } 730 }
731 731
732 if (IS_ENABLED(CONFIG_DEBUG_FS)) { 732 if (IS_ENABLED(CONFIG_DEBUG_FS)) {
733 err = tegra_dsi_debugfs_init(dsi, tegra->drm->primary); 733 err = tegra_dsi_debugfs_init(dsi, drm->primary);
734 if (err < 0) 734 if (err < 0)
735 dev_err(dsi->dev, "debugfs setup failed: %d\n", err); 735 dev_err(dsi->dev, "debugfs setup failed: %d\n", err);
736 } 736 }
diff --git a/drivers/gpu/drm/tegra/gr2d.c b/drivers/gpu/drm/tegra/gr2d.c
index 2c7ca748edf5..7c53941f2a9e 100644
--- a/drivers/gpu/drm/tegra/gr2d.c
+++ b/drivers/gpu/drm/tegra/gr2d.c
@@ -28,7 +28,7 @@ static inline struct gr2d *to_gr2d(struct tegra_drm_client *client)
28static int gr2d_init(struct host1x_client *client) 28static int gr2d_init(struct host1x_client *client)
29{ 29{
30 struct tegra_drm_client *drm = host1x_to_drm_client(client); 30 struct tegra_drm_client *drm = host1x_to_drm_client(client);
31 struct tegra_drm *tegra = dev_get_drvdata(client->parent); 31 struct drm_device *dev = dev_get_drvdata(client->parent);
32 unsigned long flags = HOST1X_SYNCPT_HAS_BASE; 32 unsigned long flags = HOST1X_SYNCPT_HAS_BASE;
33 struct gr2d *gr2d = to_gr2d(drm); 33 struct gr2d *gr2d = to_gr2d(drm);
34 34
@@ -42,17 +42,17 @@ static int gr2d_init(struct host1x_client *client)
42 return -ENOMEM; 42 return -ENOMEM;
43 } 43 }
44 44
45 return tegra_drm_register_client(tegra, drm); 45 return tegra_drm_register_client(dev->dev_private, drm);
46} 46}
47 47
48static int gr2d_exit(struct host1x_client *client) 48static int gr2d_exit(struct host1x_client *client)
49{ 49{
50 struct tegra_drm_client *drm = host1x_to_drm_client(client); 50 struct tegra_drm_client *drm = host1x_to_drm_client(client);
51 struct tegra_drm *tegra = dev_get_drvdata(client->parent); 51 struct drm_device *dev = dev_get_drvdata(client->parent);
52 struct gr2d *gr2d = to_gr2d(drm); 52 struct gr2d *gr2d = to_gr2d(drm);
53 int err; 53 int err;
54 54
55 err = tegra_drm_unregister_client(tegra, drm); 55 err = tegra_drm_unregister_client(dev->dev_private, drm);
56 if (err < 0) 56 if (err < 0)
57 return err; 57 return err;
58 58
diff --git a/drivers/gpu/drm/tegra/gr3d.c b/drivers/gpu/drm/tegra/gr3d.c
index 0cbb24b1ae04..30f5ba9bd6d0 100644
--- a/drivers/gpu/drm/tegra/gr3d.c
+++ b/drivers/gpu/drm/tegra/gr3d.c
@@ -37,7 +37,7 @@ static inline struct gr3d *to_gr3d(struct tegra_drm_client *client)
37static int gr3d_init(struct host1x_client *client) 37static int gr3d_init(struct host1x_client *client)
38{ 38{
39 struct tegra_drm_client *drm = host1x_to_drm_client(client); 39 struct tegra_drm_client *drm = host1x_to_drm_client(client);
40 struct tegra_drm *tegra = dev_get_drvdata(client->parent); 40 struct drm_device *dev = dev_get_drvdata(client->parent);
41 unsigned long flags = HOST1X_SYNCPT_HAS_BASE; 41 unsigned long flags = HOST1X_SYNCPT_HAS_BASE;
42 struct gr3d *gr3d = to_gr3d(drm); 42 struct gr3d *gr3d = to_gr3d(drm);
43 43
@@ -51,17 +51,17 @@ static int gr3d_init(struct host1x_client *client)
51 return -ENOMEM; 51 return -ENOMEM;
52 } 52 }
53 53
54 return tegra_drm_register_client(tegra, drm); 54 return tegra_drm_register_client(dev->dev_private, drm);
55} 55}
56 56
57static int gr3d_exit(struct host1x_client *client) 57static int gr3d_exit(struct host1x_client *client)
58{ 58{
59 struct tegra_drm_client *drm = host1x_to_drm_client(client); 59 struct tegra_drm_client *drm = host1x_to_drm_client(client);
60 struct tegra_drm *tegra = dev_get_drvdata(client->parent); 60 struct drm_device *dev = dev_get_drvdata(client->parent);
61 struct gr3d *gr3d = to_gr3d(drm); 61 struct gr3d *gr3d = to_gr3d(drm);
62 int err; 62 int err;
63 63
64 err = tegra_drm_unregister_client(tegra, drm); 64 err = tegra_drm_unregister_client(dev->dev_private, drm);
65 if (err < 0) 65 if (err < 0)
66 return err; 66 return err;
67 67
diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c
index fec1a63d32c9..ba067bb767e3 100644
--- a/drivers/gpu/drm/tegra/hdmi.c
+++ b/drivers/gpu/drm/tegra/hdmi.c
@@ -1347,7 +1347,7 @@ static int tegra_hdmi_debugfs_exit(struct tegra_hdmi *hdmi)
1347 1347
1348static int tegra_hdmi_init(struct host1x_client *client) 1348static int tegra_hdmi_init(struct host1x_client *client)
1349{ 1349{
1350 struct tegra_drm *tegra = dev_get_drvdata(client->parent); 1350 struct drm_device *drm = dev_get_drvdata(client->parent);
1351 struct tegra_hdmi *hdmi = host1x_client_to_hdmi(client); 1351 struct tegra_hdmi *hdmi = host1x_client_to_hdmi(client);
1352 int err; 1352 int err;
1353 1353
@@ -1355,14 +1355,14 @@ static int tegra_hdmi_init(struct host1x_client *client)
1355 hdmi->output.dev = client->dev; 1355 hdmi->output.dev = client->dev;
1356 hdmi->output.ops = &hdmi_ops; 1356 hdmi->output.ops = &hdmi_ops;
1357 1357
1358 err = tegra_output_init(tegra->drm, &hdmi->output); 1358 err = tegra_output_init(drm, &hdmi->output);
1359 if (err < 0) { 1359 if (err < 0) {
1360 dev_err(client->dev, "output setup failed: %d\n", err); 1360 dev_err(client->dev, "output setup failed: %d\n", err);
1361 return err; 1361 return err;
1362 } 1362 }
1363 1363
1364 if (IS_ENABLED(CONFIG_DEBUG_FS)) { 1364 if (IS_ENABLED(CONFIG_DEBUG_FS)) {
1365 err = tegra_hdmi_debugfs_init(hdmi, tegra->drm->primary); 1365 err = tegra_hdmi_debugfs_init(hdmi, drm->primary);
1366 if (err < 0) 1366 if (err < 0)
1367 dev_err(client->dev, "debugfs setup failed: %d\n", err); 1367 dev_err(client->dev, "debugfs setup failed: %d\n", err);
1368 } 1368 }
diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
index 7d66f6e53919..5c67d97bd21d 100644
--- a/drivers/gpu/drm/tegra/sor.c
+++ b/drivers/gpu/drm/tegra/sor.c
@@ -1044,7 +1044,7 @@ static int tegra_sor_debugfs_exit(struct tegra_sor *sor)
1044 1044
1045static int tegra_sor_init(struct host1x_client *client) 1045static int tegra_sor_init(struct host1x_client *client)
1046{ 1046{
1047 struct tegra_drm *tegra = dev_get_drvdata(client->parent); 1047 struct drm_device *drm = dev_get_drvdata(client->parent);
1048 struct tegra_sor *sor = host1x_client_to_sor(client); 1048 struct tegra_sor *sor = host1x_client_to_sor(client);
1049 int err; 1049 int err;
1050 1050
@@ -1056,14 +1056,14 @@ static int tegra_sor_init(struct host1x_client *client)
1056 sor->output.dev = sor->dev; 1056 sor->output.dev = sor->dev;
1057 sor->output.ops = &sor_ops; 1057 sor->output.ops = &sor_ops;
1058 1058
1059 err = tegra_output_init(tegra->drm, &sor->output); 1059 err = tegra_output_init(drm, &sor->output);
1060 if (err < 0) { 1060 if (err < 0) {
1061 dev_err(sor->dev, "output setup failed: %d\n", err); 1061 dev_err(sor->dev, "output setup failed: %d\n", err);
1062 return err; 1062 return err;
1063 } 1063 }
1064 1064
1065 if (IS_ENABLED(CONFIG_DEBUG_FS)) { 1065 if (IS_ENABLED(CONFIG_DEBUG_FS)) {
1066 struct dentry *root = tegra->drm->primary->debugfs_root; 1066 struct dentry *root = drm->primary->debugfs_root;
1067 1067
1068 err = tegra_sor_debugfs_init(sor, root); 1068 err = tegra_sor_debugfs_init(sor, root);
1069 if (err < 0) 1069 if (err < 0)