Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp819625ybd; Wed, 26 Jun 2019 06:33:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqx57ntAJ/Ua1S2cqdCgKvM0tW+KN3fKmJAKq11NJGWKhP3b1PPQgrL+Ar8N8AbFel0Yx/X5 X-Received: by 2002:a17:902:ab83:: with SMTP id f3mr5586011plr.122.1561555989607; Wed, 26 Jun 2019 06:33:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561555989; cv=none; d=google.com; s=arc-20160816; b=sJJaiarnybdbFe8cM3EhcuXbXciq8jDlmZazpnLVg5oEv4AuJWf9njLmdO7FPzInyD HoUoE6gJ7NODzEKxTv7V1VC/w9M8R2rNj87Jz9TOFWWSNYk5zy9bXp+wtfXK/rxF1LwH oyotgGfp/gfFVox060y76JO+eY+dC3XeTe5ddPlvQkJU5AFA0ZjUJjZKYeD2zyktSKUu HrCbZolfip18gZes/FrhAzNMChl03qK3vqdnzoT3yKTmcttlXm7b3vxoGVIoRTBSEOrz Yw+DhZGIffaz9Q2H9/FioD4JUbpYBs/NXmmzaqyh72NuNLTfR6LgvhGkH1LNujuIR7ra hLsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=l6UWDCrdqzhDoInz3DczM96EVPMbFqtzFvWBCT5zfAs=; b=ZOmeDMMneZMG7Sxc1B5eVnAWwZTw5aVmyhh+AE/oTSn3y1kTmcHbREZcjsHGPo36ae UrmlkI7DE2RELQRfEEKtQLVtKFPS6Rk38FkqIpIhcCd1Ul8K+nCf4m93B7LNzTMeOzVR EztSR6t9HbHJ6fQpztWh1wqFYJVhtOB/CLOSDX8Oa6E7SMoGyxCHjwEjHFjTEocxTmf7 7hP3uG+lsMmWSI6w4qH6XWuAlMO+BsjzaBzWjTElV9A4NClJGjDm9EsYPzGY2i04vnzE Ka/7HaSpSppOR2/LuYZfXPoB4WwpVq8PoNnsMdYye5kjXWTT3JRGSeQJXvnDCru9DXNq /LTg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y10si3356307plp.117.2019.06.26.06.32.53; Wed, 26 Jun 2019 06:33:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727796AbfFZNcd (ORCPT + 99 others); Wed, 26 Jun 2019 09:32:33 -0400 Received: from inva020.nxp.com ([92.121.34.13]:58174 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727708AbfFZNc0 (ORCPT ); Wed, 26 Jun 2019 09:32:26 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 56E1C1A0A02; Wed, 26 Jun 2019 15:32:24 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 49ED71A09EB; Wed, 26 Jun 2019 15:32:24 +0200 (CEST) Received: from fsr-ub1664-120.ea.freescale.net (fsr-ub1664-120.ea.freescale.net [10.171.82.81]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id 9A798205DB; Wed, 26 Jun 2019 15:32:23 +0200 (CEST) From: Robert Chiras To: Marek Vasut , Stefan Agner , David Airlie , Daniel Vetter , Rob Herring , Mark Rutland , Shawn Guo , Sascha Hauer , Fabio Estevam Cc: Pengutronix Kernel Team , NXP Linux Team , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Robert Chiras Subject: [PATCH 03/10] drm/mxsfb: Fix the vblank events Date: Wed, 26 Jun 2019 16:32:11 +0300 Message-Id: <1561555938-21595-4-git-send-email-robert.chiras@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1561555938-21595-1-git-send-email-robert.chiras@nxp.com> References: <1561555938-21595-1-git-send-email-robert.chiras@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, the vblank support is not correctly implemented in MXSFB_DRM driver. The call to drm_vblank_init is made with mode_config.num_crtc which at that time is 0. Because of this, vblank is not activated, so there won't be any vblank event submitted. For example, when running modetest with the '-v' parameter will result in an astronomical refresh rate (10000+ Hz), because of that. Signed-off-by: Robert Chiras --- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c index d9fb734..8d14921 100644 --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c @@ -35,6 +35,9 @@ #include "mxsfb_drv.h" #include "mxsfb_regs.h" +/* The eLCDIF max possible CRTCs */ +#define MAX_CRTCS 1 + enum mxsfb_devtype { MXSFB_V3, MXSFB_V4, @@ -135,6 +138,8 @@ static void mxsfb_pipe_enable(struct drm_simple_display_pipe *pipe, mxsfb->connector = &mxsfb->panel_connector; } + drm_crtc_vblank_on(&pipe->crtc); + pm_runtime_get_sync(drm->dev); drm_panel_prepare(mxsfb->panel); mxsfb_crtc_enable(mxsfb); @@ -161,6 +166,8 @@ static void mxsfb_pipe_disable(struct drm_simple_display_pipe *pipe) } spin_unlock_irq(&drm->event_lock); + drm_crtc_vblank_off(&pipe->crtc); + if (mxsfb->connector != &mxsfb->panel_connector) mxsfb->connector = NULL; } @@ -243,7 +250,7 @@ static int mxsfb_load(struct drm_device *drm, unsigned long flags) pm_runtime_enable(drm->dev); - ret = drm_vblank_init(drm, drm->mode_config.num_crtc); + ret = drm_vblank_init(drm, MAX_CRTCS); if (ret < 0) { dev_err(drm->dev, "Failed to initialise vblank\n"); goto err_vblank; @@ -266,6 +273,8 @@ static int mxsfb_load(struct drm_device *drm, unsigned long flags) goto err_vblank; } + drm_crtc_vblank_off(&mxsfb->pipe.crtc); + /* * Attach panel only if there is one. * If there is no panel attach, it must be a bridge. In this case, we -- 2.7.4