From patchwork Tue Feb 6 09:35:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 10202557 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4B8E36020F for ; Tue, 6 Feb 2018 09:35:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49C7128AC1 for ; Tue, 6 Feb 2018 09:35:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3EB0C28ACA; Tue, 6 Feb 2018 09:35:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D38A928AC1 for ; Tue, 6 Feb 2018 09:35:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3D70D6E3D4; Tue, 6 Feb 2018 09:35:55 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x243.google.com (mail-lf0-x243.google.com [IPv6:2a00:1450:4010:c07::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 531836E3D0 for ; Tue, 6 Feb 2018 09:35:54 +0000 (UTC) Received: by mail-lf0-x243.google.com with SMTP id x196so1730635lfd.12 for ; Tue, 06 Feb 2018 01:35:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gZ7UeLosqBcnhaH/nfwJNsAIx/MJqeHNqSNB85BvedQ=; b=SRh4rubd40NxoKP/KHBWgWyXFZYoak2et0mXA8imjYKHYKxlG5Wv3vC26MfYn3ocp+ NqnhYmz555mHVdgsPoskjiUuXA29mc2IkRyjCvBxCqTk6uLy4nkmqDLe9s668g2W5sa+ fP/teUsd24AOZ2TtAt7BM/N3XSunHmajqPXro= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gZ7UeLosqBcnhaH/nfwJNsAIx/MJqeHNqSNB85BvedQ=; b=PvPiRG5CNJbmrHm/E0H2O9LGPBDcRJ/4ufz3AT1+06UNgLiUsuwTVJ27hjduJMkSIx AOjuXaF4knro2Z/K/etOsWaU/6Hw/hNyuoWtj0tTT/TnIQUIU1VTnM+uMrzdlJ0dlOjp SEBv7HvBklENrrngwJJXowP2jMQmDdlFBTxBmosSEXlZx11h65JcYXoyIkizFAi2ytLJ ybwUQr9vV67HmieGgQNW0HQzjz/Vb3tbZBvUqxI7imkR52wYAynMcxRsfBKainmjZh/9 TXFGat0c2UKMIg3sj8TPvXs0v04WyNnPYdPtKEeo1gISbUBZ+Oy0G6PT0Tg+zr+OAciK HEVQ== X-Gm-Message-State: APf1xPCbqPZvL4mPsK2JIgReTC4iaHnA/5XcZVNrSnuyvJeApbmTGZq+ a0rFdJF7Jt8jhqFYLwZFaocLxQ== X-Google-Smtp-Source: AH8x2244KHRHQIcjMi2XFkvf/zq2WJmIx5Hjmk5nBrdHHexrnfkI2LY9Ull5NSaUTnuk1xtjCdTMJw== X-Received: by 10.25.235.86 with SMTP id j83mr1313387lfh.20.1517909752736; Tue, 06 Feb 2018 01:35:52 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id m129sm2253675lfg.75.2018.02.06.01.35.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Feb 2018 01:35:52 -0800 (PST) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 4/5 v3] drm/pl111: Support variants with broken VBLANK Date: Tue, 6 Feb 2018 10:35:39 +0100 Message-Id: <20180206093540.8147-4-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180206093540.8147-1-linus.walleij@linaro.org> References: <20180206093540.8147-1-linus.walleij@linaro.org> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The early Integrator CLCD synthesized in the Integrator CP and IM-PD1 FPGAs are broken: their vertical and next base interrupts are not functional. Support these variants by simply disabling the use of the vblank interrupt on these variants. Reviewed-by: Eric Anholt Signed-off-by: Linus Walleij --- ChangeLog ->v3: - Collect Eric's review tag. --- drivers/gpu/drm/pl111/pl111_display.c | 6 ++++-- drivers/gpu/drm/pl111/pl111_drm.h | 2 ++ drivers/gpu/drm/pl111/pl111_drv.c | 19 +++++++++++-------- drivers/gpu/drm/pl111/pl111_versatile.c | 1 + 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/pl111/pl111_display.c b/drivers/gpu/drm/pl111/pl111_display.c index 4d4e38b4c9d5..d75923896609 100644 --- a/drivers/gpu/drm/pl111/pl111_display.c +++ b/drivers/gpu/drm/pl111/pl111_display.c @@ -256,7 +256,8 @@ static void pl111_display_enable(struct drm_simple_display_pipe *pipe, cntl |= CNTL_LCDPWR; writel(cntl, priv->regs + priv->ctrl); - drm_crtc_vblank_on(crtc); + if (!priv->variant->broken_vblank) + drm_crtc_vblank_on(crtc); } void pl111_display_disable(struct drm_simple_display_pipe *pipe) @@ -266,7 +267,8 @@ void pl111_display_disable(struct drm_simple_display_pipe *pipe) struct pl111_drm_dev_private *priv = drm->dev_private; u32 cntl; - drm_crtc_vblank_off(crtc); + if (!priv->variant->broken_vblank) + drm_crtc_vblank_off(crtc); /* Power Down */ cntl = readl(priv->regs + priv->ctrl); diff --git a/drivers/gpu/drm/pl111/pl111_drm.h b/drivers/gpu/drm/pl111/pl111_drm.h index f75c5d4645b2..d74076c6b7ef 100644 --- a/drivers/gpu/drm/pl111/pl111_drm.h +++ b/drivers/gpu/drm/pl111/pl111_drm.h @@ -40,6 +40,7 @@ struct drm_minor; * BGR/RGB routing * @broken_clockdivider: the clock divider is broken and we need to * use the supplied clock directly + * @broken_vblank: the vblank IRQ is broken on this variant * @formats: array of supported pixel formats on this variant * @nformats: the length of the array of supported pixel formats */ @@ -48,6 +49,7 @@ struct pl111_variant_data { bool is_pl110; bool external_bgr; bool broken_clockdivider; + bool broken_vblank; const u32 *formats; unsigned int nformats; }; diff --git a/drivers/gpu/drm/pl111/pl111_drv.c b/drivers/gpu/drm/pl111/pl111_drv.c index 6967cd5428b2..e6fa897c740c 100644 --- a/drivers/gpu/drm/pl111/pl111_drv.c +++ b/drivers/gpu/drm/pl111/pl111_drv.c @@ -131,10 +131,12 @@ static int pl111_modeset_init(struct drm_device *dev) if (ret) return ret; - ret = drm_vblank_init(dev, 1); - if (ret != 0) { - dev_err(dev->dev, "Failed to init vblank\n"); - goto out_bridge; + if (!priv->variant->broken_vblank) { + ret = drm_vblank_init(dev, 1); + if (ret != 0) { + dev_err(dev->dev, "Failed to init vblank\n"); + goto out_bridge; + } } drm_mode_config_reset(dev); @@ -184,10 +186,6 @@ static struct drm_driver pl111_drm_driver = { .dumb_create = drm_gem_cma_dumb_create, .gem_free_object_unlocked = drm_gem_cma_free_object, .gem_vm_ops = &drm_gem_cma_vm_ops, - - .enable_vblank = pl111_enable_vblank, - .disable_vblank = pl111_disable_vblank, - .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, .gem_prime_import = drm_gem_prime_import, @@ -213,6 +211,11 @@ static int pl111_amba_probe(struct amba_device *amba_dev, if (!priv) return -ENOMEM; + if (!variant->broken_vblank) { + pl111_drm_driver.enable_vblank = pl111_enable_vblank; + pl111_drm_driver.disable_vblank = pl111_disable_vblank; + } + drm = drm_dev_alloc(&pl111_drm_driver, dev); if (IS_ERR(drm)) return PTR_ERR(drm); diff --git a/drivers/gpu/drm/pl111/pl111_versatile.c b/drivers/gpu/drm/pl111/pl111_versatile.c index 93cf2d82074b..11024ad64181 100644 --- a/drivers/gpu/drm/pl111/pl111_versatile.c +++ b/drivers/gpu/drm/pl111/pl111_versatile.c @@ -238,6 +238,7 @@ static const struct pl111_variant_data pl110_integrator = { .name = "PL110 Integrator", .is_pl110 = true, .broken_clockdivider = true, + .broken_vblank = true, .formats = pl110_integrator_pixel_formats, .nformats = ARRAY_SIZE(pl110_integrator_pixel_formats), };