linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: info@lategoodbye.de (Stefan Wahren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 3/7] drm/vc4: Add KMS support for Raspberry Pi.
Date: Sun, 11 Oct 2015 16:02:12 +0200	[thread overview]
Message-ID: <561A6BE4.9080409@lategoodbye.de> (raw)
In-Reply-To: <1444426068-15817-4-git-send-email-eric@anholt.net>

Hi Eric,

Am 09.10.2015 um 23:27 schrieb Eric Anholt:
> This is enough for fbcon and bringing up X using
> xf86-video-modesetting.  It doesn't support the 3D accelerator or
> power management yet.
>
> Signed-off-by: Eric Anholt <eric@anholt.net>
> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>
> v2: Drop FB_HELPER select thanks to Archit's patches.  Do manual init
>      ordering instead of using the .load hook.  Structure registration
>      more like tegra's, but still using the typical "component" code.
>      Drop no-op hooks for atomic_begin and mode_fixup() now that
>      they're optional.  Drop sentinel in Makefile.  Fix minor style
>      nits I noticed on another reread.
>
> v3: Use the new bcm2835 clk driver to manage pixel/HSM clocks instead
>      of having a fixed video mode.  Use exynos-style component driver
>      matching instead of devicetree nodes to list the component driver
>      instances.  Rename compatibility strings to say bcm2835, and
>      distinguish pv0/1/2.  Clean up some h/vsync code, and add in
>      interlaced mode setup.  Fix up probe/bind error paths.  Use
>      bitops.h macros for vc4_regs.h
>
>   drivers/gpu/drm/Kconfig           |   2 +
>   drivers/gpu/drm/Makefile          |   1 +
>   drivers/gpu/drm/vc4/Kconfig       |  13 +
>   drivers/gpu/drm/vc4/Makefile      |  17 +
>   drivers/gpu/drm/vc4/vc4_bo.c      |  52 +++
>   drivers/gpu/drm/vc4/vc4_crtc.c    | 675 ++++++++++++++++++++++++++++++++++++++
>   drivers/gpu/drm/vc4/vc4_debugfs.c |  39 +++
>   drivers/gpu/drm/vc4/vc4_drv.c     | 284 ++++++++++++++++
>   drivers/gpu/drm/vc4/vc4_drv.h     | 115 +++++++
>   drivers/gpu/drm/vc4/vc4_hdmi.c    | 588 +++++++++++++++++++++++++++++++++
>   drivers/gpu/drm/vc4/vc4_hvs.c     | 163 +++++++++
>   drivers/gpu/drm/vc4/vc4_kms.c     |  54 +++
>   drivers/gpu/drm/vc4/vc4_plane.c   | 320 ++++++++++++++++++
>   drivers/gpu/drm/vc4/vc4_regs.h    | 570 ++++++++++++++++++++++++++++++++
>   14 files changed, 2893 insertions(+)
>   create mode 100644 drivers/gpu/drm/vc4/Kconfig
>   create mode 100644 drivers/gpu/drm/vc4/Makefile
>   create mode 100644 drivers/gpu/drm/vc4/vc4_bo.c
>   create mode 100644 drivers/gpu/drm/vc4/vc4_crtc.c
>   create mode 100644 drivers/gpu/drm/vc4/vc4_debugfs.c
>   create mode 100644 drivers/gpu/drm/vc4/vc4_drv.c
>   create mode 100644 drivers/gpu/drm/vc4/vc4_drv.h
>   create mode 100644 drivers/gpu/drm/vc4/vc4_hdmi.c
>   create mode 100644 drivers/gpu/drm/vc4/vc4_hvs.c
>   create mode 100644 drivers/gpu/drm/vc4/vc4_kms.c
>   create mode 100644 drivers/gpu/drm/vc4/vc4_plane.c
>   create mode 100644 drivers/gpu/drm/vc4/vc4_regs.h
>
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index 1a0a8df..c4bf9a1 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -264,3 +264,5 @@ source "drivers/gpu/drm/sti/Kconfig"
>   source "drivers/gpu/drm/amd/amdkfd/Kconfig"
>
>   source "drivers/gpu/drm/imx/Kconfig"
> +
> +source "drivers/gpu/drm/vc4/Kconfig"
> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> index 45e7719..0edc9e2 100644
> --- a/drivers/gpu/drm/Makefile
> +++ b/drivers/gpu/drm/Makefile
> @@ -42,6 +42,7 @@ obj-$(CONFIG_DRM_MGA)	+= mga/
>   obj-$(CONFIG_DRM_I810)	+= i810/
>   obj-$(CONFIG_DRM_I915)  += i915/
>   obj-$(CONFIG_DRM_MGAG200) += mgag200/
> +obj-$(CONFIG_DRM_VC4)  += vc4/
>   obj-$(CONFIG_DRM_CIRRUS_QEMU) += cirrus/
>   obj-$(CONFIG_DRM_SIS)   += sis/
>   obj-$(CONFIG_DRM_SAVAGE)+= savage/
> diff --git a/drivers/gpu/drm/vc4/Kconfig b/drivers/gpu/drm/vc4/Kconfig
> new file mode 100644
> index 0000000..e810ef7
> --- /dev/null
> +++ b/drivers/gpu/drm/vc4/Kconfig
> @@ -0,0 +1,13 @@
> +config DRM_VC4
> +	tristate "Broadcom VC4 Graphics"
> +	depends on ARCH_BCM2835

depends on (ARCH_BCM2835 || COMPILE_TEST) ?

> +	depends on DRM
> +	select DRM_KMS_HELPER
> +	select DRM_KMS_CMA_HELPER
> +	help
> +	  Choose this option if you have a system that has a Broadcom
> +	  VC4 GPU, such as the Raspberry Pi or other BCM2708/BCM2835.
> +
> +	  This driver requires that "avoid_warnings=2" be present in
> +	  the config.txt for the firmware, to keep it from smashing
> +	  our display setup.
> + [...]
> +static void vc4_crtc_disable(struct drm_crtc *crtc)
> +{
> +	struct drm_device *dev = crtc->dev;
> +	struct vc4_dev *vc4 = to_vc4_dev(dev);
> +	struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc);
> +	u32 chan = vc4_crtc->channel;
> +
> +	require_hvs_enabled(dev);
> +
> +	CRTC_WRITE(PV_V_CONTROL,
> +		   CRTC_READ(PV_V_CONTROL) & ~PV_VCONTROL_VIDEN);
> +	while (CRTC_READ(PV_V_CONTROL) & PV_VCONTROL_VIDEN)
> +		cpu_relax();
> +
> +	/* Without a wait here, we end up with a black screen. */
> +	msleep(30);

This looks a little bit strange. First we do a busy loop without any 
timeout and then a fixed msleep without reason for the exact duration.

Sorry for the possibly dumb questions:

Is it safe to read PV_V_CONTROL exactly after writing to them? No 
sleeping required?

How did you come to the 30 milli seconds?

> +  [...]
> diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
> new file mode 100644
> index 0000000..ae37fec
> --- /dev/null
> +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
> @@ -0,0 +1,588 @@
> +/*
> + * Copyright (C) 2015 Broadcom
> + * Copyright (c) 2014 The Linux Foundation. All rights reserved.
> + * Copyright (C) 2013 Red Hat
> + * Author: Rob Clark <robdclark@gmail.com>
> + *
> + * 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.
> + *
> + * This program is distributed in the hope that it will be useful, but WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
> + * more details.
> + *
> + * You should have received a copy of the GNU General Public License along with
> + * this program.  If not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +/**
> + * DOC: VC4 Falcon HDMI module
> + *
> + * The HDMI core has a state machine and a PHY.  Most of the unit
> + * operates off of the HSM clock from CPRMAN.  It also internally uses
> + * the PLLH_PIX clock for the PHY.
> + */
> +
> +#include "drm_atomic_helper.h"
> +#include "drm_crtc_helper.h"
> +#include "drm_edid.h"
> +#include "linux/clk.h"
> +#include "linux/component.h"

#include "linux/i2c.h" ?

> +#include "linux/of_gpio.h"
> +#include "linux/of_platform.h"
> +#include "vc4_drv.h"
> +#include "vc4_regs.h"
> +
> +/* General HDMI hardware state. */
> +struct vc4_hdmi {
> +	struct platform_device *pdev;
> +
> +	struct drm_encoder *encoder;
> +	struct drm_connector *connector;
> +
> +	struct i2c_adapter *ddc;
> +	void __iomem *hdmicore_regs;
> +	void __iomem *hd_regs;
> +	int hpd_gpio;
> +
> +	struct clk *pixel_clock;
> +	struct clk *hsm_clock;
> +};
> +

Best regards
Stefan

  reply	other threads:[~2015-10-11 14:02 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-09 21:27 bcm2835 (Raspberry Pi) KMS driver Eric Anholt
2015-10-09 21:27 ` [PATCH v3 1/7] drm/vc4: Add devicetree bindings for VC4 Eric Anholt
2015-10-09 23:31   ` Sebastian Reichel
2015-10-13 17:59     ` Eric Anholt
2015-10-13 13:26   ` Rob Herring
2015-10-13 18:17     ` Eric Anholt
2015-10-13 21:56       ` Rob Herring
2015-10-21  8:57         ` Eric Anholt
2015-10-21 22:08           ` Rob Herring
2015-10-09 21:27 ` [PATCH v3 2/7] MAINTAINERS: Add myself for the new VC4 (RPi GPU) graphics driver Eric Anholt
2015-10-09 22:12   ` Emil Velikov
2015-10-09 23:13     ` Eric Anholt
2015-10-09 21:27 ` [PATCH v3 3/7] drm/vc4: Add KMS support for Raspberry Pi Eric Anholt
2015-10-11 14:02   ` Stefan Wahren [this message]
2015-10-13 18:19     ` Eric Anholt
2015-10-13 18:50       ` Stefan Wahren
2015-10-13 19:01         ` Stefan Wahren
2015-10-09 21:27 ` [PATCH v3 4/7] drm/vc4: Use the fbdev_cma helpers Eric Anholt
2015-10-09 21:27 ` [PATCH v3 5/7] drm/vc4: Allow vblank to be disabled Eric Anholt
2015-10-09 21:27 ` [PATCH v3 6/7] ARM: bcm2835: Add the DDC I2C controller to the device tree Eric Anholt
2015-10-09 21:27 ` [PATCH v3 7/7] ARM: bcm2835: Add VC4 " Eric Anholt
2015-10-11 14:23   ` Stefan Wahren
2015-10-12 20:57     ` Eric Anholt
2015-10-11 12:39 ` bcm2835 (Raspberry Pi) KMS driver Stefan Wahren
2015-10-12 20:39   ` Stephen Warren
2015-10-12 20:53     ` Eric Anholt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=561A6BE4.9080409@lategoodbye.de \
    --to=info@lategoodbye.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).