Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9910f5c4 authored by Thierry Reding's avatar Thierry Reding
Browse files

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: default avatarThierry Reding <treding@nvidia.com>
parent b528ae71
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
ccflags-$(CONFIG_DRM_TEGRA_DEBUG) += -DDEBUG

tegra-drm-y := \
	bus.o \
	drm.o \
	gem.o \
	fb.o \

drivers/gpu/drm/tegra/bus.c

deleted100644 → 0
+0 −64
Original line number Diff line number Diff line
/*
 * Copyright (C) 2013 NVIDIA Corporation
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#include "drm.h"

static int drm_host1x_set_busid(struct drm_device *dev,
				struct drm_master *master)
{
	const char *device = dev_name(dev->dev);
	const char *bus = dev->dev->bus->name;

	master->unique_len = strlen(bus) + 1 + strlen(device);
	master->unique_size = master->unique_len;

	master->unique = kmalloc(master->unique_len + 1, GFP_KERNEL);
	if (!master->unique)
		return -ENOMEM;

	snprintf(master->unique, master->unique_len + 1, "%s:%s", bus, device);

	return 0;
}

static struct drm_bus drm_host1x_bus = {
	.set_busid = drm_host1x_set_busid,
};

int drm_host1x_init(struct drm_driver *driver, struct host1x_device *device)
{
	struct drm_device *drm;
	int ret;

	driver->bus = &drm_host1x_bus;

	drm = drm_dev_alloc(driver, &device->dev);
	if (!drm)
		return -ENOMEM;

	ret = drm_dev_register(drm, 0);
	if (ret)
		goto err_free;

	DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", driver->name,
		 driver->major, driver->minor, driver->patchlevel,
		 driver->date, drm->primary->index);

	return 0;

err_free:
	drm_dev_unref(drm);
	return ret;
}

void drm_host1x_exit(struct drm_driver *driver, struct host1x_device *device)
{
	struct tegra_drm *tegra = dev_get_drvdata(&device->dev);

	drm_put_dev(tegra->drm);
}
+5 −5
Original line number Diff line number Diff line
@@ -1104,26 +1104,26 @@ static int tegra_dc_debugfs_exit(struct tegra_dc *dc)

static int tegra_dc_init(struct host1x_client *client)
{
	struct tegra_drm *tegra = dev_get_drvdata(client->parent);
	struct drm_device *drm = dev_get_drvdata(client->parent);
	struct tegra_dc *dc = host1x_client_to_dc(client);
	int err;

	drm_crtc_init(tegra->drm, &dc->base, &tegra_crtc_funcs);
	drm_crtc_init(drm, &dc->base, &tegra_crtc_funcs);
	drm_mode_crtc_set_gamma_size(&dc->base, 256);
	drm_crtc_helper_add(&dc->base, &tegra_crtc_helper_funcs);

	err = tegra_dc_rgb_init(tegra->drm, dc);
	err = tegra_dc_rgb_init(drm, dc);
	if (err < 0 && err != -ENODEV) {
		dev_err(dc->dev, "failed to initialize RGB output: %d\n", err);
		return err;
	}

	err = tegra_dc_add_planes(tegra->drm, dc);
	err = tegra_dc_add_planes(drm, dc);
	if (err < 0)
		return err;

	if (IS_ENABLED(CONFIG_DEBUG_FS)) {
		err = tegra_dc_debugfs_init(dc, tegra->drm->primary);
		err = tegra_dc_debugfs_init(dc, drm->primary);
		if (err < 0)
			dev_err(dc->dev, "debugfs setup failed: %d\n", err);
	}
+30 −5
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ static int tegra_drm_load(struct drm_device *drm, unsigned long flags)
	if (!tegra)
		return -ENOMEM;

	dev_set_drvdata(drm->dev, tegra);
	mutex_init(&tegra->clients_lock);
	INIT_LIST_HEAD(&tegra->clients);
	drm->dev_private = tegra;
@@ -640,14 +639,40 @@ int tegra_drm_unregister_client(struct tegra_drm *tegra,
	return 0;
}

static int host1x_drm_probe(struct host1x_device *device)
static int host1x_drm_probe(struct host1x_device *dev)
{
	return drm_host1x_init(&tegra_drm_driver, device);
	struct drm_driver *driver = &tegra_drm_driver;
	struct drm_device *drm;
	int err;

	drm = drm_dev_alloc(driver, &dev->dev);
	if (!drm)
		return -ENOMEM;

	drm_dev_set_unique(drm, dev_name(&dev->dev));
	dev_set_drvdata(&dev->dev, drm);

	err = drm_dev_register(drm, 0);
	if (err < 0)
		goto unref;

	DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", driver->name,
		 driver->major, driver->minor, driver->patchlevel,
		 driver->date, drm->primary->index);

	return 0;

unref:
	drm_dev_unref(drm);
	return err;
}

static int host1x_drm_remove(struct host1x_device *device)
static int host1x_drm_remove(struct host1x_device *dev)
{
	drm_host1x_exit(&tegra_drm_driver, device);
	struct drm_device *drm = dev_get_drvdata(&dev->dev);

	drm_dev_unregister(drm);
	drm_dev_unref(drm);

	return 0;
}
+0 −4
Original line number Diff line number Diff line
@@ -249,10 +249,6 @@ static inline int tegra_output_check_mode(struct tegra_output *output,
	return output ? -ENOSYS : -EINVAL;
}

/* from bus.c */
int drm_host1x_init(struct drm_driver *driver, struct host1x_device *device);
void drm_host1x_exit(struct drm_driver *driver, struct host1x_device *device);

/* from rgb.c */
int tegra_dc_rgb_probe(struct tegra_dc *dc);
int tegra_dc_rgb_remove(struct tegra_dc *dc);
Loading