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

Commit 38f070eb authored by Dave Airlie's avatar Dave Airlie
Browse files

Merge tag 'drm/tegra/for-5.1-rc1' of git://anongit.freedesktop.org/tegra/linux into drm-next



drm/tegra: Changes for v5.1-rc1

This set of changes starts of with some refactoring of the CEC support
to make it reusable on Tegra210 and later. Following are a couple of
fixes for HDMI audio support (via HDA).

The bulk here is a set of preparatory patches working towards enabling
Tegra186 support for host1x and VIC. Additional patches will be needed
to fully enable this, but they're not quite ready yet.

To round things off, this also adds support for configuring the SOR
crossbar using device tree, and fixes a couple of job-related issues in
the host1x code.

Signed-off-by: default avatarDave Airlie <airlied@redhat.com>

From: Thierry Reding <thierry.reding@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190208144721.25830-1-thierry.reding@gmail.com
parents 0ad7fb7c 79930baf
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -238,6 +238,9 @@ of the following host1x client modules:
  - nvidia,hpd-gpio: specifies a GPIO used for hotplug detection
  - nvidia,edid: supplies a binary EDID blob
  - nvidia,panel: phandle of a display panel
  - nvidia,xbar-cfg: 5 cells containing the crossbar configuration. Each lane
    of the SOR, identified by the cell's index, is mapped via the crossbar to
    the pad specified by the cell's value.

  Optional properties when driving an eDP output:
  - nvidia,dpaux: phandle to a DispayPort AUX interface
+1 −0
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ tegra-drm-y := \
	dc.o \
	output.o \
	rgb.o \
	hda.o \
	hdmi.o \
	mipi-phy.o \
	dsi.o \
+32 −25
Original line number Diff line number Diff line
@@ -92,10 +92,6 @@ static int tegra_drm_load(struct drm_device *drm, unsigned long flags)
		return -ENOMEM;

	if (iommu_present(&platform_bus_type)) {
		u64 carveout_start, carveout_end, gem_start, gem_end;
		struct iommu_domain_geometry *geometry;
		unsigned long order;

		tegra->domain = iommu_domain_alloc(&platform_bus_type);
		if (!tegra->domain) {
			err = -ENOMEM;
@@ -105,27 +101,6 @@ static int tegra_drm_load(struct drm_device *drm, unsigned long flags)
		err = iova_cache_get();
		if (err < 0)
			goto domain;

		geometry = &tegra->domain->geometry;
		gem_start = geometry->aperture_start;
		gem_end = geometry->aperture_end - CARVEOUT_SZ;
		carveout_start = gem_end + 1;
		carveout_end = geometry->aperture_end;

		order = __ffs(tegra->domain->pgsize_bitmap);
		init_iova_domain(&tegra->carveout.domain, 1UL << order,
				 carveout_start >> order);

		tegra->carveout.shift = iova_shift(&tegra->carveout.domain);
		tegra->carveout.limit = carveout_end >> tegra->carveout.shift;

		drm_mm_init(&tegra->mm, gem_start, gem_end - gem_start + 1);
		mutex_init(&tegra->mm_lock);

		DRM_DEBUG("IOMMU apertures:\n");
		DRM_DEBUG("  GEM: %#llx-%#llx\n", gem_start, gem_end);
		DRM_DEBUG("  Carveout: %#llx-%#llx\n", carveout_start,
			  carveout_end);
	}

	mutex_init(&tegra->clients_lock);
@@ -159,6 +134,36 @@ static int tegra_drm_load(struct drm_device *drm, unsigned long flags)
	if (err < 0)
		goto fbdev;

	if (tegra->domain) {
		u64 carveout_start, carveout_end, gem_start, gem_end;
		u64 dma_mask = dma_get_mask(&device->dev);
		dma_addr_t start, end;
		unsigned long order;

		start = tegra->domain->geometry.aperture_start & dma_mask;
		end = tegra->domain->geometry.aperture_end & dma_mask;

		gem_start = start;
		gem_end = end - CARVEOUT_SZ;
		carveout_start = gem_end + 1;
		carveout_end = end;

		order = __ffs(tegra->domain->pgsize_bitmap);
		init_iova_domain(&tegra->carveout.domain, 1UL << order,
				 carveout_start >> order);

		tegra->carveout.shift = iova_shift(&tegra->carveout.domain);
		tegra->carveout.limit = carveout_end >> tegra->carveout.shift;

		drm_mm_init(&tegra->mm, gem_start, gem_end - gem_start + 1);
		mutex_init(&tegra->mm_lock);

		DRM_DEBUG("IOMMU apertures:\n");
		DRM_DEBUG("  GEM: %#llx-%#llx\n", gem_start, gem_end);
		DRM_DEBUG("  Carveout: %#llx-%#llx\n", carveout_start,
			  carveout_end);
	}

	if (tegra->hub) {
		err = tegra_display_hub_prepare(tegra->hub);
		if (err < 0)
@@ -1041,6 +1046,7 @@ int tegra_drm_register_client(struct tegra_drm *tegra,
{
	mutex_lock(&tegra->clients_lock);
	list_add_tail(&client->list, &tegra->clients);
	client->drm = tegra;
	mutex_unlock(&tegra->clients_lock);

	return 0;
@@ -1051,6 +1057,7 @@ int tegra_drm_unregister_client(struct tegra_drm *tegra,
{
	mutex_lock(&tegra->clients_lock);
	list_del_init(&client->list);
	client->drm = NULL;
	mutex_unlock(&tegra->clients_lock);

	return 0;
+2 −1
Original line number Diff line number Diff line
@@ -88,6 +88,7 @@ int tegra_drm_submit(struct tegra_drm_context *context,
struct tegra_drm_client {
	struct host1x_client base;
	struct list_head list;
	struct tegra_drm *drm;

	unsigned int version;
	const struct tegra_drm_client_ops *ops;
@@ -124,7 +125,7 @@ struct tegra_output {
	struct drm_panel *panel;
	struct i2c_adapter *ddc;
	const struct edid *edid;
	struct cec_notifier *notifier;
	struct cec_notifier *cec;
	unsigned int hpd_irq;
	int hpd_gpio;
	enum of_gpio_flags hpd_gpio_flags;
+63 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: MIT
/*
 * Copyright (C) 2019 NVIDIA Corporation
 */

#include <linux/bug.h>

#include <sound/hda_verbs.h>

#include "hda.h"

void tegra_hda_parse_format(unsigned int format, struct tegra_hda_format *fmt)
{
	unsigned int mul, div, bits, channels;

	if (format & AC_FMT_TYPE_NON_PCM)
		fmt->pcm = false;
	else
		fmt->pcm = true;

	if (format & AC_FMT_BASE_44K)
		fmt->sample_rate = 44100;
	else
		fmt->sample_rate = 48000;

	mul = (format & AC_FMT_MULT_MASK) >> AC_FMT_MULT_SHIFT;
	div = (format & AC_FMT_DIV_MASK) >> AC_FMT_DIV_SHIFT;

	fmt->sample_rate *= (mul + 1) / (div + 1);

	switch (format & AC_FMT_BITS_MASK) {
	case AC_FMT_BITS_8:
		fmt->bits = 8;
		break;

	case AC_FMT_BITS_16:
		fmt->bits = 16;
		break;

	case AC_FMT_BITS_20:
		fmt->bits = 20;
		break;

	case AC_FMT_BITS_24:
		fmt->bits = 24;
		break;

	case AC_FMT_BITS_32:
		fmt->bits = 32;
		break;

	default:
		bits = (format & AC_FMT_BITS_MASK) >> AC_FMT_BITS_SHIFT;
		WARN(1, "invalid number of bits: %#x\n", bits);
		fmt->bits = 8;
		break;
	}

	channels = (format & AC_FMT_CHAN_MASK) >> AC_FMT_CHAN_SHIFT;

	/* channels are encoded as n - 1 */
	fmt->channels = channels + 1;
}
Loading