From patchwork Mon Feb 12 09:44:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 127957 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3040207ljc; Mon, 12 Feb 2018 01:45:41 -0800 (PST) X-Google-Smtp-Source: AH8x224d+/toBoKnB7qfjaYLHG3bcWEmzDqXBKgL+xQYmME9rlrTRv5zILNARBXmNLM1dX6TnKt3 X-Received: by 2002:a17:902:46a:: with SMTP id 97-v6mr10029536ple.96.1518428741680; Mon, 12 Feb 2018 01:45:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518428741; cv=none; d=google.com; s=arc-20160816; b=e3i3XeryFQla7m08UmNNFdMF+fYZqoFMgICkC8CC1wNLLWvKaoXg0WegnuXWH9GBoK bwfMx/BqWq0vKvhln864RhIxJVgAoLlobEXhQe08fwP1R81tAQceyLck9mj+70zNMdnA oahsTNxk01qcX4uMSFZrzJp5+fwEhh6s/J2lee6ZVYNorDiEQG7f5WvHq5oz578Pg3Mk U1OgLZg1KJkosZaYlTwXMgyaOlRTK8oR9nWmtkSKY35CBJQ+U0G/sIgXb/k8F9SvUPqq EGE8f/YxESNq/JkNtTXXGbkH0aAWNsb7ri3J5hD0TXGZOIgmYovWiSPpYHUSQ0PoEsPX e36Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=Js8ViUNEksVYeup7J2n6l1KPdc9VCjHS8POpFRgvbNI=; b=PCqXMfVRj20hcNZy9rAwhnc/8ql3EEDOPx+slasPX2k4mBFCDkesDCMQyqWLNjESCi VZbLYEuP9CQyQPk2F86R3qM7xhF/TcTN3VMSTI8iTdOe20fZv3R7N3xJUjw1dlBZpTU9 FdZ4Qh6c8iYqOj6do0oeOdDulM7mDjHfeNCTgF9iVcDtlEo0gx/i5KbTEimrtpbs5zlA vHzodh5jQl1rp2xWz3bDe0qXxk89lR1Qq06aLPmaLh5Hr1XhqpwHoo/dp8xbUitHhjHi jgSeaxDkJG8fKZnzeiOlBD6WXejzYoR+DU4g9+YLtMRXwNqPR3JQP/YVLnANTpHt0OlD FfLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=us3xohYF; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id h1-v6si3850074pln.138.2018.02.12.01.45.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 01:45:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=us3xohYF; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 20E916E10B; Mon, 12 Feb 2018 09:45:08 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelnx194.ext.ti.com (lelnx194.ext.ti.com [198.47.27.80]) by gabe.freedesktop.org (Postfix) with ESMTPS id 29E506E10B for ; Mon, 12 Feb 2018 09:45:07 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1C9j45v007761; Mon, 12 Feb 2018 03:45:04 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1518428704; bh=98H6MP+T2Zac1qtl9lQhxtqOwM/KCmzhaFJl1vYAAj8=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=us3xohYFJgEpzbCLqmu6G19mMMT2763iuieCgfIxWdHXOYKZInX0tC6eVuNmttSaM M59dzknwy6mT5ZYaiAqsTXJmOsjd2VKrRRKFuQIeHj/lybR/TTEgoiGkMeILDo+yV0 /SoJ58AYE6rcS9oSQs9WEg1t1MHeKLJRWxRMY914= Received: from DLEE101.ent.ti.com (dlee101.ent.ti.com [157.170.170.31]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9j42A018084; Mon, 12 Feb 2018 03:45:04 -0600 Received: from DLEE105.ent.ti.com (157.170.170.35) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 12 Feb 2018 03:45:04 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 12 Feb 2018 03:45:04 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9j0Mw003439; Mon, 12 Feb 2018 03:45:02 -0600 From: Tomi Valkeinen To: , Laurent Pinchart , Peter Ujfalusi , Jyri Sarha , Benoit Parrot Subject: [PATCH 01/24] drm/omap: fix omap_fbdev_free() when omap_fbdev_create() wasn't called Date: Mon, 12 Feb 2018 11:44:31 +0200 Message-ID: <1518428694-18018-2-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> References: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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: Tomi Valkeinen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" If we have no crtcs/connectors, fbdev init goes fine, but omap_fbdev_create() is never called. This means that omap_fbdev->bo is NULL and omap_fbdev_free() crashes. Add a check to omap_fbdev_free() to handle the NULL case. Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/omapdrm/omap_fbdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c index 1ace63e2ff22..632ebcf2165f 100644 --- a/drivers/gpu/drm/omapdrm/omap_fbdev.c +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c @@ -303,7 +303,8 @@ void omap_fbdev_free(struct drm_device *dev) fbdev = to_omap_fbdev(priv->fbdev); /* unpin the GEM object pinned in omap_fbdev_create() */ - omap_gem_unpin(fbdev->bo); + if (fbdev->bo) + omap_gem_unpin(fbdev->bo); /* this will free the backing object */ if (fbdev->fb) From patchwork Mon Feb 12 09:44:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 127954 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3039902ljc; Mon, 12 Feb 2018 01:45:15 -0800 (PST) X-Google-Smtp-Source: AH8x224DZobjenjEnr1aQHx3RI2sdK72nCrTFnYRaAZyuyo+2pUCrt5YNEVyKeSMmF0bEsKTiAU4 X-Received: by 10.99.103.129 with SMTP id b123mr8694722pgc.177.1518428715562; Mon, 12 Feb 2018 01:45:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518428715; cv=none; d=google.com; s=arc-20160816; b=DaYcsoTs0eKJz9sSzzAzfGqS/APehHXAWCdIpUSBVnn6A4i/kowLelo/vUEJpsWHTM RlRFF9U/NPVye0MNVnD77oq94Qe5JhlTftunpbp1U1VWS/ZpIuyeZOQ1aj9Nupdhl9Lg mbKYCQTDHCpHI/Ye9wQYsBbG3gaQxuEJQo81fqpvaN0UYU1izusSKlnBAZMglzXSSqJA FkgDDkF1j1jefoO/VAhoMp2TyklrTFm2m6lRp/BuTE6BPOG/nepotC23gORW345V9w9/ GOud/2ZwrDHFhF4modnHkSFwzNuU1QkJRs4TTaSASJuNGJrQ3ybcbtdt8kdoYWPNnQjq Uzlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=3LGZTNpl9dqzJf/ttFsiEocr38hNSWuY1G42pMJFy/Q=; b=YS/Z9RsfQ8UNXkADrmit+o9MSYCRFwto+tvjIj0GP6SxuZXDxtqkDbAl1NX6bIJS7D h2TSU1acF9GSpo39xYavWpcpi/B1w43kw5r/pmao/sJSBt1vEEiYYV5J0ElGVSFkADIF It3W5xSfTsnzJpwUaLIoNujJukWaZvUqu+Iq72YtVusVJTd6QPUpfANWcgxstgd3NTcw U8I2iPg+/Ce7CStCszXLk02nKLTuCWdYMwBAhKMQYNUEavFVW9olmZwPp9GFi1ZZMcOV EjAIlncZ9Hi1aDYHBKkHvo0Z6ESf6GUuEeLaMhC02nlY+8c8ES44t5EA1DCr4Xlv9dBx wqqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=AU3Bl67g; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id i6-v6si2428811plt.26.2018.02.12.01.45.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 01:45:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=AU3Bl67g; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2E4356E105; Mon, 12 Feb 2018 09:45:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllnx210.ext.ti.com (fllnx210.ext.ti.com [198.47.19.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1CFCD6E116 for ; Mon, 12 Feb 2018 09:45:08 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1C9j62Z009799; Mon, 12 Feb 2018 03:45:06 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1518428706; bh=wCbMuXuobc2njkHneRHZAVS/pPvDxz2ipcTGTYQ5ZyM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=AU3Bl67gY/zzAYTxPbWhK047RGgsX4kUs0PSs6hMTVWWmHa5MF81PuEWc+jFYdn0L 3FxX9PAhj55NR7Gnp2Ausmdaq5rQLXUcINxe4ASCAxN0j4kMW+Qai+yn2jrKjWtq/Q AeOzbD1pgEsYy10Nq/WXhl9dhMl8rCwrsFj+iPcg= Received: from DLEE112.ent.ti.com (dlee112.ent.ti.com [157.170.170.23]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9j6Ki018993; Mon, 12 Feb 2018 03:45:06 -0600 Received: from DLEE114.ent.ti.com (157.170.170.25) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 12 Feb 2018 03:45:05 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE114.ent.ti.com (157.170.170.25) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 12 Feb 2018 03:45:05 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9j0Mx003439; Mon, 12 Feb 2018 03:45:04 -0600 From: Tomi Valkeinen To: , Laurent Pinchart , Peter Ujfalusi , Jyri Sarha , Benoit Parrot Subject: [PATCH 02/24] drm/omap: cleanup fbdev init/free Date: Mon, 12 Feb 2018 11:44:32 +0200 Message-ID: <1518428694-18018-3-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> References: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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: Tomi Valkeinen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" omap_fbdev_init() and omap_fbdev_free() use priv->fbdev directly. However, omap_fbdev_init() returns the fbdev, and omap_drv.c also assigns the return value to priv->fbdev. This is slightly confusing. Clean this up by removing the omap_fbdev_init() return value, as we don't care whether fbdev init succeeded or not. Also change omap_drv.c to call omap_fbdev_init() always, and omap_fbdev_init() does the check if fbdev was initialized. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/omap_drv.c | 9 ++++----- drivers/gpu/drm/omapdrm/omap_fbdev.c | 10 +++++----- drivers/gpu/drm/omapdrm/omap_fbdev.h | 5 ++--- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index dd68b2556f5b..485684c637ff 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -584,7 +584,7 @@ static int pdev_probe(struct platform_device *pdev) for (i = 0; i < priv->num_crtcs; i++) drm_crtc_vblank_off(priv->crtcs[i]); - priv->fbdev = omap_fbdev_init(ddev); + omap_fbdev_init(ddev); drm_kms_helper_poll_init(ddev); omap_modeset_enable_external_hpd(); @@ -602,8 +602,8 @@ static int pdev_probe(struct platform_device *pdev) err_cleanup_helpers: omap_modeset_disable_external_hpd(); drm_kms_helper_poll_fini(ddev); - if (priv->fbdev) - omap_fbdev_free(ddev); + + omap_fbdev_free(ddev); err_cleanup_modeset: drm_mode_config_cleanup(ddev); omap_drm_irq_uninstall(ddev); @@ -632,8 +632,7 @@ static int pdev_remove(struct platform_device *pdev) omap_modeset_disable_external_hpd(); drm_kms_helper_poll_fini(ddev); - if (priv->fbdev) - omap_fbdev_free(ddev); + omap_fbdev_free(ddev); drm_atomic_helper_shutdown(ddev); diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c index 632ebcf2165f..30ce3d562414 100644 --- a/drivers/gpu/drm/omapdrm/omap_fbdev.c +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c @@ -242,7 +242,7 @@ static struct drm_fb_helper *get_fb(struct fb_info *fbi) } /* initialize fbdev helper */ -struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev) +void omap_fbdev_init(struct drm_device *dev) { struct omap_drm_private *priv = dev->dev_private; struct omap_fbdev *fbdev = NULL; @@ -275,7 +275,7 @@ struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev) priv->fbdev = helper; - return helper; + return; fini: drm_fb_helper_fini(helper); @@ -283,9 +283,6 @@ struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev) kfree(fbdev); dev_warn(dev->dev, "omap_fbdev_init failed\n"); - /* well, limp along without an fbdev.. maybe X11 will work? */ - - return NULL; } void omap_fbdev_free(struct drm_device *dev) @@ -296,6 +293,9 @@ void omap_fbdev_free(struct drm_device *dev) DBG(); + if (!priv->fbdev) + return; + drm_fb_helper_unregister_fbi(helper); drm_fb_helper_fini(helper); diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.h b/drivers/gpu/drm/omapdrm/omap_fbdev.h index 1f5ba0996a1a..3bd6ea661a18 100644 --- a/drivers/gpu/drm/omapdrm/omap_fbdev.h +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.h @@ -24,12 +24,11 @@ struct drm_device; struct drm_fb_helper; #ifdef CONFIG_DRM_FBDEV_EMULATION -struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev); +void omap_fbdev_init(struct drm_device *dev); void omap_fbdev_free(struct drm_device *dev); #else -static inline struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev) +static inline void omap_fbdev_init(struct drm_device *dev) { - return NULL; } static inline void omap_fbdev_free(struct drm_device *dev) { From patchwork Mon Feb 12 09:44:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 127956 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3039940ljc; Mon, 12 Feb 2018 01:45:19 -0800 (PST) X-Google-Smtp-Source: AH8x225j4rPuHtx7vJrutPzX8BXW6ATXk1Qntna7UR/O6kTllg5t7Jel4s8dYfXARpduxa7sUTBc X-Received: by 10.99.178.68 with SMTP id t4mr8673861pgo.441.1518428719447; Mon, 12 Feb 2018 01:45:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518428719; cv=none; d=google.com; s=arc-20160816; b=BGVRrjt7ZOc9F47lyFwj0dxutsyezqQbPoptEabrHReKGHZAu2hKg6qeFZraqMeuwS R9+gXlxCabdn3kLGZwreqbFvzQqjrdx/XBlckobAgQUpUZZnlGbbNANtjQF3pkjZXW53 0/zyVjrPC1FYRBiiIjECxzRRZMgCRC09FI6tiR8Hm5JEJpLW1wjNm3z+YqUZ/bi9eQvm 3TBegz4GCBGeDSdmQ7p1URbXNvEqWsnFOMER3DUTSuZgG98zmUNohNT7i8g7gE/Bxdc+ irXHJ8B627f7WqQrsFcIMVGcYkNjkyD+vmxVrcZ1AW2EPmq0dN6PLHOEvc9S1q4wfVbv nO+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=OVASx763KokSH/uSlYL1zaNnVIX7yrppkMKaTNXxUsw=; b=h9hL7FsTnaEiN9USf1BxC8TFXoyQxIR1iKvBycarbUgOCXiNWxrtQQH+bymRoqtz+c mijJgQ1iEudy/f84R4VdLS37sjAl11Q/iU5qUGY5E58yWuPbNcW6pzubwBahRqAn7MC1 cls9dfPQ9XcskrFVB/WpCuufI5ikaB0DB+/Rr/sxYuP4RrDKv/6eW1/Ok2+tKiyUW2N7 z33UijgqnOWCr8OY1sP9sgTTrd0qjz/r9attnw1O4wNSkigrxx1WO5bdrD4wX2ljs7OJ SvSL12oUnB9mWuFLoUPEWjMYCDQOgxvlT/7ivHZYqdYKNx8GHFza1L2sXFE1+k08LOLQ BO9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=JJjIVZ+J; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id j8-v6si5549856plk.87.2018.02.12.01.45.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 01:45:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=JJjIVZ+J; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ABA4F6E0FE; Mon, 12 Feb 2018 09:45:15 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllnx209.ext.ti.com (fllnx209.ext.ti.com [198.47.19.16]) by gabe.freedesktop.org (Postfix) with ESMTPS id ACBA26E0FE for ; Mon, 12 Feb 2018 09:45:10 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1C9j8WU018915; Mon, 12 Feb 2018 03:45:08 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1518428708; bh=H65BvV2LDjTcU1453VdihF57+3quk/EKMF7KJpE0Vqw=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=JJjIVZ+JilDcpIWsVfxoA7sQodimSnplmtNPpU6eKn5e+XA78UXIiBfYlrmppiVeV UVHE64ZJ34u1fa7CaiqA9BCCPK7clJceScs/TDeWhWHJguuDtX0Q/XyWjad3xpSDYe XAS3YnFOhJpHuqEtxVVANP+6e3lTRQN/ImcLNvY4= Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9j84M019122; Mon, 12 Feb 2018 03:45:08 -0600 Received: from DFLE101.ent.ti.com (10.64.6.22) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 12 Feb 2018 03:45:07 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE101.ent.ti.com (10.64.6.22) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 12 Feb 2018 03:45:07 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9j0N0003439; Mon, 12 Feb 2018 03:45:06 -0600 From: Tomi Valkeinen To: , Laurent Pinchart , Peter Ujfalusi , Jyri Sarha , Benoit Parrot Subject: [PATCH 03/24] drm/omap: add HPD support to connector-dvi Date: Mon, 12 Feb 2018 11:44:33 +0200 Message-ID: <1518428694-18018-4-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> References: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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: Tomi Valkeinen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add HPD support to the DVI connector driver. The code is almost identical to the HPD code in the HDMI connector driver. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/displays/connector-dvi.c | 114 +++++++++++++++++++++++ 1 file changed, 114 insertions(+) diff --git a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c index 391d80364346..f9f8700223c3 100644 --- a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c +++ b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c @@ -13,6 +13,7 @@ #include #include #include +#include #include @@ -44,6 +45,13 @@ struct panel_drv_data { struct videomode vm; struct i2c_adapter *i2c_adapter; + + struct gpio_desc *hpd_gpio; + + void (*hpd_cb)(void *cb_data, enum drm_connector_status status); + void *hpd_cb_data; + bool hpd_enabled; + struct mutex hpd_lock; }; #define to_panel_data(x) container_of(x, struct panel_drv_data, dssdev) @@ -189,6 +197,9 @@ static int dvic_read_edid(struct omap_dss_device *dssdev, struct panel_drv_data *ddata = to_panel_data(dssdev); int r, l, bytes_read; + if (ddata->hpd_gpio && !gpiod_get_value_cansleep(ddata->hpd_gpio)) + return -ENODEV; + if (!ddata->i2c_adapter) return -ENODEV; @@ -220,6 +231,9 @@ static bool dvic_detect(struct omap_dss_device *dssdev) unsigned char out; int r; + if (ddata->hpd_gpio) + return gpiod_get_value_cansleep(ddata->hpd_gpio); + if (!ddata->i2c_adapter) return true; @@ -228,6 +242,60 @@ static bool dvic_detect(struct omap_dss_device *dssdev) return r == 0; } +static int dvic_register_hpd_cb(struct omap_dss_device *dssdev, + void (*cb)(void *cb_data, + enum drm_connector_status status), + void *cb_data) +{ + struct panel_drv_data *ddata = to_panel_data(dssdev); + + if (!ddata->hpd_gpio) + return -ENOTSUPP; + + mutex_lock(&ddata->hpd_lock); + ddata->hpd_cb = cb; + ddata->hpd_cb_data = cb_data; + mutex_unlock(&ddata->hpd_lock); + return 0; +} + +static void dvic_unregister_hpd_cb(struct omap_dss_device *dssdev) +{ + struct panel_drv_data *ddata = to_panel_data(dssdev); + + if (!ddata->hpd_gpio) + return; + + mutex_lock(&ddata->hpd_lock); + ddata->hpd_cb = NULL; + ddata->hpd_cb_data = NULL; + mutex_unlock(&ddata->hpd_lock); +} + +static void dvic_enable_hpd(struct omap_dss_device *dssdev) +{ + struct panel_drv_data *ddata = to_panel_data(dssdev); + + if (!ddata->hpd_gpio) + return; + + mutex_lock(&ddata->hpd_lock); + ddata->hpd_enabled = true; + mutex_unlock(&ddata->hpd_lock); +} + +static void dvic_disable_hpd(struct omap_dss_device *dssdev) +{ + struct panel_drv_data *ddata = to_panel_data(dssdev); + + if (!ddata->hpd_gpio) + return; + + mutex_lock(&ddata->hpd_lock); + ddata->hpd_enabled = false; + mutex_unlock(&ddata->hpd_lock); +} + static struct omap_dss_driver dvic_driver = { .connect = dvic_connect, .disconnect = dvic_disconnect, @@ -241,14 +309,60 @@ static struct omap_dss_driver dvic_driver = { .read_edid = dvic_read_edid, .detect = dvic_detect, + + .register_hpd_cb = dvic_register_hpd_cb, + .unregister_hpd_cb = dvic_unregister_hpd_cb, + .enable_hpd = dvic_enable_hpd, + .disable_hpd = dvic_disable_hpd, }; +static irqreturn_t dvic_hpd_isr(int irq, void *data) +{ + struct panel_drv_data *ddata = data; + + mutex_lock(&ddata->hpd_lock); + if (ddata->hpd_enabled && ddata->hpd_cb) { + enum drm_connector_status status; + + if (dvic_detect(&ddata->dssdev)) + status = connector_status_connected; + else + status = connector_status_disconnected; + + ddata->hpd_cb(ddata->hpd_cb_data, status); + } + mutex_unlock(&ddata->hpd_lock); + + return IRQ_HANDLED; +} + static int dvic_probe_of(struct platform_device *pdev) { struct panel_drv_data *ddata = platform_get_drvdata(pdev); struct device_node *node = pdev->dev.of_node; struct device_node *adapter_node; struct i2c_adapter *adapter; + struct gpio_desc *gpio; + int r; + + gpio = devm_gpiod_get_optional(&pdev->dev, "hpd", GPIOD_IN); + if (IS_ERR(gpio)) { + dev_err(&pdev->dev, "failed to parse HPD gpio\n"); + return PTR_ERR(gpio); + } + + ddata->hpd_gpio = gpio; + + mutex_init(&ddata->hpd_lock); + + if (ddata->hpd_gpio) { + r = devm_request_threaded_irq(&pdev->dev, + gpiod_to_irq(ddata->hpd_gpio), NULL, dvic_hpd_isr, + IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, + "DVI HPD", ddata); + if (r) + return r; + } adapter_node = of_parse_phandle(node, "ddc-i2c-bus", 0); if (adapter_node) { From patchwork Mon Feb 12 09:44:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 127961 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3040344ljc; Mon, 12 Feb 2018 01:45:55 -0800 (PST) X-Google-Smtp-Source: AH8x225yffHxlwUsYSVMRL6nYyGUyM1PdWFLHSPepBI3wfVO8GCSK6yes+8p3wtlOqxIOrmkUgvA X-Received: by 10.99.176.69 with SMTP id z5mr8591792pgo.74.1518428754907; Mon, 12 Feb 2018 01:45:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518428754; cv=none; d=google.com; s=arc-20160816; b=OYpfFPAIBv+hWErqbCRvthn9d4WEnqNtEct4JvnywWWRirMFW3KNfA8IGwOjECvYwd b+ixMyAWWR+7DAvPfM2fchPToQE2SpuGq1UOWazoEJCGwnslzm8amAKEk2T+3gPN3HEm 9XWg+vDZOK490baa8pb4Y7jdRzP7+4RME3rSKcP/t5P5Y2Hhv3D5vqf/XKbB2tiOGFCM 2+deVS9MYDoRBePkYRJyCFTjgqxBGrseG9CH1RXmHXLm7CLpz8XtLskdsRbjnVsl/ONq Z3VvswSRVa9oHUMMb1+o0EP6YKOwDy1VQ+lbwHKArsBSGf2+m0SD4q8qBvRuCH5cGcEO OxQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=w7ZhQvcyFmJkWvBj5TC1R7Bweusk/oc+8ckwSYR7tDw=; b=FIkhywqzA1Q7Q73LKvB5j3uSdPeK54a9TmVxoJx5YU0nGg4xHq19SCM9W+PJ7lG7ZF dgUVvPBbYR+QY0i9StpQGQzHtyueKFOqv4JQA0T7Svt0G1XW0Q2WEciK8EOUDgtbYLfY 2WHvgAL29SKGiNSyuKHWy/TcZdaGmm6IAoup5eCFk+yyOB3xgBG9gxbh4AjTpPenUmcV 0zXB/7/J09yjxQgqeTKB5lhny9sgkRpMJY22kq6ER9G3Y4dcVznwbjOk5vU2Lklm0RCd /QXFHAGE6b/bVn49B5u6719NI4qYE1gepZPQDTHXFAl8bNxH/x1gzvw7y7wNUzKU5BDz firQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=e+MM9DVM; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id 28si4235960pfl.53.2018.02.12.01.45.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 01:45:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=e+MM9DVM; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0D9DE6E142; Mon, 12 Feb 2018 09:45:16 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllnx210.ext.ti.com (fllnx210.ext.ti.com [198.47.19.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6EF0A6E0FE for ; Mon, 12 Feb 2018 09:45:14 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1C9jCQv009808; Mon, 12 Feb 2018 03:45:12 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1518428712; bh=y+0aibwKwH/XgsflE87fLWw+DWaz2Y69oCR70SMeF34=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=e+MM9DVMEiVJJzWYHwzeP+DdVaod6LhN/ph/f/JA50Ihe+wtS+i/No7QV0rUrBWsI TQa1LYSIuBbspASTDtFp3Xg77p9czqcSPSFuxK3I9AeUdPGJbKwnWJpFXamnKKR9vJ kSXvK7neqvutYIQBBp/9SMj5pkO53dAAANGH1Uv4= Received: from DFLE105.ent.ti.com (dfle105.ent.ti.com [10.64.6.26]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9jCAm019281; Mon, 12 Feb 2018 03:45:12 -0600 Received: from DFLE105.ent.ti.com (10.64.6.26) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 12 Feb 2018 03:45:11 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 12 Feb 2018 03:45:11 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9j0N2003439; Mon, 12 Feb 2018 03:45:10 -0600 From: Tomi Valkeinen To: , Laurent Pinchart , Peter Ujfalusi , Jyri Sarha , Benoit Parrot Subject: [PATCH 05/24] drm/omap: Use devm_kzalloc() to allocate omap_drm_private Date: Mon, 12 Feb 2018 11:44:35 +0200 Message-ID: <1518428694-18018-6-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> References: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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: Tomi Valkeinen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Peter Ujfalusi It makes the cleanup paths a bit cleaner. Signed-off-by: Peter Ujfalusi Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/omap_drv.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index 485684c637ff..3cd9188ab30b 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -529,19 +529,17 @@ static int pdev_probe(struct platform_device *pdev) return ret; } + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + omap_crtc_pre_init(); ret = omap_connect_dssdevs(); if (ret) goto err_crtc_uninit; - /* Allocate and initialize the driver private structure. */ - priv = kzalloc(sizeof(*priv), GFP_KERNEL); - if (!priv) { - ret = -ENOMEM; - goto err_disconnect_dssdevs; - } - + /* Initialize the driver private structure. */ priv->dispc_ops = dispc_get_ops(); soc = soc_device_match(omapdrm_soc_devices); @@ -555,7 +553,7 @@ static int pdev_probe(struct platform_device *pdev) ddev = drm_dev_alloc(&omap_drm_driver, &pdev->dev); if (IS_ERR(ddev)) { ret = PTR_ERR(ddev); - goto err_free_priv; + goto err_destroy_wq; } ddev->dev_private = priv; @@ -610,10 +608,8 @@ static int pdev_probe(struct platform_device *pdev) err_free_drm_dev: omap_gem_deinit(ddev); drm_dev_unref(ddev); -err_free_priv: +err_destroy_wq: destroy_workqueue(priv->wq); - kfree(priv); -err_disconnect_dssdevs: omap_disconnect_dssdevs(); err_crtc_uninit: omap_crtc_pre_uninit(); @@ -644,7 +640,6 @@ static int pdev_remove(struct platform_device *pdev) drm_dev_unref(ddev); destroy_workqueue(priv->wq); - kfree(priv); omap_disconnect_dssdevs(); omap_crtc_pre_uninit(); From patchwork Mon Feb 12 09:44:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 127958 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3040211ljc; Mon, 12 Feb 2018 01:45:42 -0800 (PST) X-Google-Smtp-Source: AH8x227M8sDOM05L5avZNrrJAXZS7V5yt3oweNeHN0MLhXxw2D++Ykvwal7AjNK/WcHYDMchHi2y X-Received: by 10.99.2.67 with SMTP id 64mr9046199pgc.117.1518428741850; Mon, 12 Feb 2018 01:45:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518428741; cv=none; d=google.com; s=arc-20160816; b=C22j7QbMECTYV540t2Kd9H8/Dr0KdJQdXoltPzRNE8DhWTPQz6fpbsKUVvPEmjfp5o Ke0Kyqb5FLF5dx4LnxXuPcsSFcBR+/Il+Zy82fKTonXzvlR96h1o5P5RaKzzlIArqOEy cjCg0Ld5MVvKi5w01WtBxOKXdMAhcFaGfIhT09YAg6I8DA+1273K93qd8AYsglO7JsnO ntNeqk20fAbplQMJkAL9B69K+IjannKFkksXeguCD6MXtBBX3GLP5lgmL1KrHbdMUYlC 5tkSWqSL4qyDP+xZz0aDuib6y36jRsRRUpGSHpc5fwbzkwCZmcQJNYDgSOloK88Uh/BX qnmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=cpziUGSAH0YNfDYxQN21xwDSwtpAiFyTRRAFZyCOeKQ=; b=HoHdmPIy8eEPrEm2dm8mOgOTbM5N4ybyaqXwi0+rfX1Cw8u8LdMhHDs2rp37+WHMbi s2Rw0hFXVKZ79dJTt1bduUMSFhyCSrMA9C2qkfbiFtelGNu8Al67poguXQHCPZ+nuDQl 2vorrQ5uB9V4iQrf7K9TCaktmwsCP20TfVdioulApyUUGcLDZ55CTWbvu5zm2o/76D3k ZVMG0mEZACgVdBKEp+C7bUdXUHl1ChykwKp9COuKF4u2qRam6UjitXAfuq2HgLgO+toO wJQ+8xZm49WUyIMSqVtFfS30Iel7AdXz4xvweH9FQnf+HEu3G9uV/sEVHMT3i3ZNLQ0L kxRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=xPvZPLnG; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id d19si755321pfk.194.2018.02.12.01.45.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 01:45:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=xPvZPLnG; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 14D416E164; Mon, 12 Feb 2018 09:45:21 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllnx209.ext.ti.com (fllnx209.ext.ti.com [198.47.19.16]) by gabe.freedesktop.org (Postfix) with ESMTPS id 605816E143 for ; Mon, 12 Feb 2018 09:45:16 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1C9jELx018927; Mon, 12 Feb 2018 03:45:14 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1518428714; bh=/nrhXs0M2g3HICvmru5MCUupu6UaI0sj3oSuYGOZ7dU=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=xPvZPLnGpyghFhChjU3iFEQafKR2k+10Np9iW60xwieElaPc0bwaBkO0JJ4qJ2loi OM0hX03FZK0vYWRiXOV3tn9yKUAbhjLc+ZlquCdo8dwa2zHr30Ka+UfvlVXs3OGyYY x2pN224jcDxZaid/idgKORqdYNbdEmniFWFLT9Ls= Received: from DLEE102.ent.ti.com (dlee102.ent.ti.com [157.170.170.32]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9jDeI018528; Mon, 12 Feb 2018 03:45:13 -0600 Received: from DLEE110.ent.ti.com (157.170.170.21) by DLEE102.ent.ti.com (157.170.170.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 12 Feb 2018 03:45:13 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 12 Feb 2018 03:45:13 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9j0N3003439; Mon, 12 Feb 2018 03:45:12 -0600 From: Tomi Valkeinen To: , Laurent Pinchart , Peter Ujfalusi , Jyri Sarha , Benoit Parrot Subject: [PATCH 06/24] drm/omap: Allocate drm_device earlier and unref it as last step Date: Mon, 12 Feb 2018 11:44:36 +0200 Message-ID: <1518428694-18018-7-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> References: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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: Tomi Valkeinen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Peter Ujfalusi If we allocate the drm_device earlier we can just return the error code without the need to use goto. Do the unref of the drm_device as a last step when cleaning up. This will make the drm_device available longer for us and makes sure that we only free up the memory when all other cleanups have been already done. Signed-off-by: Peter Ujfalusi Reviewed-by: Laurent Pinchart Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/omap_drv.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index 3cd9188ab30b..57d11f9aeead 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -533,6 +533,14 @@ static int pdev_probe(struct platform_device *pdev) if (!priv) return -ENOMEM; + /* Allocate and initialize the DRM device. */ + ddev = drm_dev_alloc(&omap_drm_driver, &pdev->dev); + if (IS_ERR(ddev)) + return PTR_ERR(ddev); + + ddev->dev_private = priv; + platform_set_drvdata(pdev, ddev); + omap_crtc_pre_init(); ret = omap_connect_dssdevs(); @@ -549,16 +557,6 @@ static int pdev_probe(struct platform_device *pdev) spin_lock_init(&priv->list_lock); INIT_LIST_HEAD(&priv->obj_list); - /* Allocate and initialize the DRM device. */ - ddev = drm_dev_alloc(&omap_drm_driver, &pdev->dev); - if (IS_ERR(ddev)) { - ret = PTR_ERR(ddev); - goto err_destroy_wq; - } - - ddev->dev_private = priv; - platform_set_drvdata(pdev, ddev); - /* Get memory bandwidth limits */ if (priv->dispc_ops->get_memory_bandwidth_limit) priv->max_bandwidth = @@ -569,7 +567,7 @@ static int pdev_probe(struct platform_device *pdev) ret = omap_modeset_init(ddev); if (ret) { dev_err(&pdev->dev, "omap_modeset_init failed: ret=%d\n", ret); - goto err_free_drm_dev; + goto err_gem_deinit; } /* Initialize vblank handling, start with all CRTCs disabled. */ @@ -605,14 +603,13 @@ static int pdev_probe(struct platform_device *pdev) err_cleanup_modeset: drm_mode_config_cleanup(ddev); omap_drm_irq_uninstall(ddev); -err_free_drm_dev: +err_gem_deinit: omap_gem_deinit(ddev); - drm_dev_unref(ddev); -err_destroy_wq: destroy_workqueue(priv->wq); omap_disconnect_dssdevs(); err_crtc_uninit: omap_crtc_pre_uninit(); + drm_dev_unref(ddev); return ret; } @@ -637,13 +634,13 @@ static int pdev_remove(struct platform_device *pdev) omap_drm_irq_uninstall(ddev); omap_gem_deinit(ddev); - drm_dev_unref(ddev); - destroy_workqueue(priv->wq); omap_disconnect_dssdevs(); omap_crtc_pre_uninit(); + drm_dev_unref(ddev); + return 0; } From patchwork Mon Feb 12 09:44:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 127962 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3040445ljc; Mon, 12 Feb 2018 01:46:05 -0800 (PST) X-Google-Smtp-Source: AH8x226OybsXzWNhoDpVy1ftrF76xhNfO6iP1kNCV1DoOKXz2wtewJZhT80M75b6N3Q0bs/FLXtv X-Received: by 2002:a17:902:5982:: with SMTP id p2-v6mr6762953pli.289.1518428764984; Mon, 12 Feb 2018 01:46:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518428764; cv=none; d=google.com; s=arc-20160816; b=W9JCLt+14wKdIgXlysltlTGyONmx5AdZyrUR9XFfZxwy3r9Kc/yMMDSooujvytdcP8 iiOd1Z64+7WRq94oi+G6ReYebUPX9y6LTZihsv5pj+0v0iYJwrXEG/ISh+XxbwySeOqP TrW7KqQtmrwcmwSqP8QH2735ygDYRxfTpUNzwZv1mLXbdkP+lqlkEVqoBja+paDcpZCN +dqxaX7YdrLCz6GlLcFEk41jdGeGC2JRh6We0QxLsIakQ9a000fpKcZy3gdPrXu5LJyQ I2I2PHIppMqhPy/9tsSXxVZzuqidL3Fpz2fiUdVLieNmaH6AZyz8xPq/V/6qV1Zw6bX+ 9Oxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=ygH6sdjyL1sayPmku/dakO/yoQaoUJeIe9hT3R4wo54=; b=za1veDRpQweGnF8HVbH7WDDra5phbhiKF1gblH65Ah8iMfKVRjGvsTQGv4ePoimkJp MgU6zv0WY602R1b1i0+3qXW3eSYM0sHWJ7fCxubkNnKAWH+1Yc82wnpKWgidh0yOKXxL Zu1gnq+7RQEAAtxKTNywkvc+zNnP8md3WYZKTe8gFcfGequMzZ749yPljrq9JL7oJtRf uh4LC7iOptqXvk/DH5rdQwazkAQhmxIIRqMknR6NCdTBjQpuu+zRUKRqwsLiOyMzBLTI P9suEMm2rdvU7UwquE1l9IPmqDEFkIH9G5GYDdNG0d5WcWrxQQ/CJqkLEndoUlAw1cA2 9k9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=IXtcyXxs; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id y88si608430pfj.85.2018.02.12.01.46.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 01:46:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=IXtcyXxs; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CDBD86E16F; Mon, 12 Feb 2018 09:45:20 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllnx210.ext.ti.com (fllnx210.ext.ti.com [198.47.19.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id E07406E14F for ; Mon, 12 Feb 2018 09:45:17 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1C9jF0a009847; Mon, 12 Feb 2018 03:45:15 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1518428715; bh=sbu+6KB0+X/J4BnUv6QEu8YQAI86XCaJHKhhUG06pB4=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=IXtcyXxs0qwjX3IrEb8FJ3J88SrRyMs9fPW6eg2Sg9x3dUBTHdAE9HMC1oL/0p+I4 BDlLe6mwnyYMgpCo/uPkvLmnX1sQPKrBSkXU2hvDsGgjNWMtykxrncf/f2uetnK0ze HDN1XVF9LJ9/9phccF6bXVgs8F/L4nHyvtVEFC5M= Received: from DFLE115.ent.ti.com (dfle115.ent.ti.com [10.64.6.36]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9jFn9019438; Mon, 12 Feb 2018 03:45:15 -0600 Received: from DFLE115.ent.ti.com (10.64.6.36) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 12 Feb 2018 03:45:15 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 12 Feb 2018 03:45:15 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9j0N4003439; Mon, 12 Feb 2018 03:45:13 -0600 From: Tomi Valkeinen To: , Laurent Pinchart , Peter Ujfalusi , Jyri Sarha , Benoit Parrot Subject: [PATCH 07/24] drm/omap: Manage the usable omap_dss_device list within omap_drm_private Date: Mon, 12 Feb 2018 11:44:37 +0200 Message-ID: <1518428694-18018-8-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> References: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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: Tomi Valkeinen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Peter Ujfalusi Instead of reaching back to DSS to iterate through the dss_devices every time, use an internal array where we store the available and usable dss_devices. At the same time remove the omapdss_device_is_connected() check from omap_modeset_init() as it became irrelevant: We are not adding dssdevs if their connect failed. Signed-off-by: Peter Ujfalusi Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/omapdrm/omap_drv.c | 95 +++++++++++++++++++++++--------------- drivers/gpu/drm/omapdrm/omap_drv.h | 3 ++ 2 files changed, 62 insertions(+), 36 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index 57d11f9aeead..869a8ab6aa4e 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -149,18 +149,27 @@ static int get_connector_type(struct omap_dss_device *dssdev) } } -static void omap_disconnect_dssdevs(void) +static void omap_disconnect_dssdevs(struct drm_device *ddev) { - struct omap_dss_device *dssdev = NULL; + struct omap_drm_private *priv = ddev->dev_private; + unsigned int i; + + for (i = 0; i < priv->num_dssdevs; i++) { + struct omap_dss_device *dssdev = priv->dssdevs[i]; - for_each_dss_dev(dssdev) dssdev->driver->disconnect(dssdev); + priv->dssdevs[i] = NULL; + omap_dss_put_device(dssdev); + } + + priv->num_dssdevs = 0; } -static int omap_connect_dssdevs(void) +static int omap_connect_dssdevs(struct drm_device *ddev) { - int r; + struct omap_drm_private *priv = ddev->dev_private; struct omap_dss_device *dssdev = NULL; + int r; if (!omapdss_stack_is_ready()) return -EPROBE_DEFER; @@ -173,6 +182,14 @@ static int omap_connect_dssdevs(void) } else if (r) { dev_warn(dssdev->dev, "could not connect display: %s\n", dssdev->name); + } else { + omap_dss_get_device(dssdev); + priv->dssdevs[priv->num_dssdevs++] = dssdev; + if (priv->num_dssdevs == ARRAY_SIZE(priv->dssdevs)) { + /* To balance the 'for_each_dss_dev' loop */ + omap_dss_put_device(dssdev); + break; + } } } @@ -183,7 +200,7 @@ static int omap_connect_dssdevs(void) * if we are deferring probe, we disconnect the devices we previously * connected */ - omap_disconnect_dssdevs(); + omap_disconnect_dssdevs(ddev); return r; } @@ -208,7 +225,7 @@ static int omap_modeset_init(struct drm_device *dev) int num_ovls = priv->dispc_ops->get_num_ovls(); int num_mgrs = priv->dispc_ops->get_num_mgrs(); int num_crtcs, crtc_idx, plane_idx; - int ret; + int ret, i; u32 plane_crtc_mask; drm_mode_config_init(dev); @@ -225,11 +242,7 @@ static int omap_modeset_init(struct drm_device *dev) * configuration does not match the expectations or exceeds * the available resources, the configuration is rejected. */ - num_crtcs = 0; - for_each_dss_dev(dssdev) - if (omapdss_device_is_connected(dssdev)) - num_crtcs++; - + num_crtcs = priv->num_dssdevs; if (num_crtcs > num_mgrs || num_crtcs > num_ovls || num_crtcs > ARRAY_SIZE(priv->crtcs) || num_crtcs > ARRAY_SIZE(priv->planes) || @@ -247,15 +260,13 @@ static int omap_modeset_init(struct drm_device *dev) crtc_idx = 0; plane_idx = 0; - for_each_dss_dev(dssdev) { + for (i = 0; i < priv->num_dssdevs; i++) { + struct omap_dss_device *dssdev = priv->dssdevs[i]; struct drm_connector *connector; struct drm_encoder *encoder; struct drm_plane *plane; struct drm_crtc *crtc; - if (!omapdss_device_is_connected(dssdev)) - continue; - encoder = omap_encoder_init(dev, dssdev); if (!encoder) return -ENOMEM; @@ -329,11 +340,14 @@ static int omap_modeset_init(struct drm_device *dev) /* * Enable the HPD in external components if supported */ -static void omap_modeset_enable_external_hpd(void) +static void omap_modeset_enable_external_hpd(struct drm_device *ddev) { - struct omap_dss_device *dssdev = NULL; + struct omap_drm_private *priv = ddev->dev_private; + int i; + + for (i = 0; i < priv->num_dssdevs; i++) { + struct omap_dss_device *dssdev = priv->dssdevs[i]; - for_each_dss_dev(dssdev) { if (dssdev->driver->enable_hpd) dssdev->driver->enable_hpd(dssdev); } @@ -342,11 +356,14 @@ static void omap_modeset_enable_external_hpd(void) /* * Disable the HPD in external components if supported */ -static void omap_modeset_disable_external_hpd(void) +static void omap_modeset_disable_external_hpd(struct drm_device *ddev) { - struct omap_dss_device *dssdev = NULL; + struct omap_drm_private *priv = ddev->dev_private; + int i; + + for (i = 0; i < priv->num_dssdevs; i++) { + struct omap_dss_device *dssdev = priv->dssdevs[i]; - for_each_dss_dev(dssdev) { if (dssdev->driver->disable_hpd) dssdev->driver->disable_hpd(dssdev); } @@ -543,7 +560,7 @@ static int pdev_probe(struct platform_device *pdev) omap_crtc_pre_init(); - ret = omap_connect_dssdevs(); + ret = omap_connect_dssdevs(ddev); if (ret) goto err_crtc_uninit; @@ -583,7 +600,7 @@ static int pdev_probe(struct platform_device *pdev) omap_fbdev_init(ddev); drm_kms_helper_poll_init(ddev); - omap_modeset_enable_external_hpd(); + omap_modeset_enable_external_hpd(ddev); /* * Register the DRM device with the core and the connectors with @@ -596,7 +613,7 @@ static int pdev_probe(struct platform_device *pdev) return 0; err_cleanup_helpers: - omap_modeset_disable_external_hpd(); + omap_modeset_disable_external_hpd(ddev); drm_kms_helper_poll_fini(ddev); omap_fbdev_free(ddev); @@ -606,7 +623,7 @@ static int pdev_probe(struct platform_device *pdev) err_gem_deinit: omap_gem_deinit(ddev); destroy_workqueue(priv->wq); - omap_disconnect_dssdevs(); + omap_disconnect_dssdevs(ddev); err_crtc_uninit: omap_crtc_pre_uninit(); drm_dev_unref(ddev); @@ -622,7 +639,7 @@ static int pdev_remove(struct platform_device *pdev) drm_dev_unregister(ddev); - omap_modeset_disable_external_hpd(); + omap_modeset_disable_external_hpd(ddev); drm_kms_helper_poll_fini(ddev); omap_fbdev_free(ddev); @@ -636,7 +653,7 @@ static int pdev_remove(struct platform_device *pdev) destroy_workqueue(priv->wq); - omap_disconnect_dssdevs(); + omap_disconnect_dssdevs(ddev); omap_crtc_pre_uninit(); drm_dev_unref(ddev); @@ -645,11 +662,14 @@ static int pdev_remove(struct platform_device *pdev) } #ifdef CONFIG_PM_SLEEP -static int omap_drm_suspend_all_displays(void) +static int omap_drm_suspend_all_displays(struct drm_device *ddev) { - struct omap_dss_device *dssdev = NULL; + struct omap_drm_private *priv = ddev->dev_private; + int i; + + for (i = 0; i < priv->num_dssdevs; i++) { + struct omap_dss_device *dssdev = priv->dssdevs[i]; - for_each_dss_dev(dssdev) { if (!dssdev->driver) continue; @@ -664,11 +684,14 @@ static int omap_drm_suspend_all_displays(void) return 0; } -static int omap_drm_resume_all_displays(void) +static int omap_drm_resume_all_displays(struct drm_device *ddev) { - struct omap_dss_device *dssdev = NULL; + struct omap_drm_private *priv = ddev->dev_private; + int i; + + for (i = 0; i < priv->num_dssdevs; i++) { + struct omap_dss_device *dssdev = priv->dssdevs[i]; - for_each_dss_dev(dssdev) { if (!dssdev->driver) continue; @@ -688,7 +711,7 @@ static int omap_drm_suspend(struct device *dev) drm_kms_helper_poll_disable(drm_dev); drm_modeset_lock_all(drm_dev); - omap_drm_suspend_all_displays(); + omap_drm_suspend_all_displays(drm_dev); drm_modeset_unlock_all(drm_dev); return 0; @@ -699,7 +722,7 @@ static int omap_drm_resume(struct device *dev) struct drm_device *drm_dev = dev_get_drvdata(dev); drm_modeset_lock_all(drm_dev); - omap_drm_resume_all_displays(); + omap_drm_resume_all_displays(drm_dev); drm_modeset_unlock_all(drm_dev); drm_kms_helper_poll_enable(drm_dev); diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h index ba322c519999..c9e433a91cd0 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.h +++ b/drivers/gpu/drm/omapdrm/omap_drv.h @@ -50,6 +50,9 @@ struct omap_drm_private { const struct dispc_ops *dispc_ops; + unsigned int num_dssdevs; + struct omap_dss_device *dssdevs[8]; + unsigned int num_crtcs; struct drm_crtc *crtcs[8]; From patchwork Mon Feb 12 09:44:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 127963 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3040564ljc; Mon, 12 Feb 2018 01:46:15 -0800 (PST) X-Google-Smtp-Source: AH8x226DXofmAjCf3SSnJs6AI+fYpQD7XxHAP9NsuOEWtwhDpwezoKco4B6OolUe4nATakbwo0K1 X-Received: by 10.99.96.137 with SMTP id u131mr9124566pgb.103.1518428775108; Mon, 12 Feb 2018 01:46:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518428775; cv=none; d=google.com; s=arc-20160816; b=iW+3b2/pU/AQjoe6VtgJLy84QWVjZxuX5cZpEbyq7jVKYhlcoPHodZ2kzDm7cKLWfX gE+CTG6Vbb0aBEWeNS/XurwCYrzh7yxTByK6LoGquN4QwMWMVO6LoHG6zB69GrvpbdVW qEfSkupYGaN27VaYnWOUvTLkHMizanjTn86TkF/gopeL9N1IlircgC0mRkk2Lifpsm0X I/W2oXs1F7ofkt8BIs7A0IrpTdrrqTFfJvportFMkjMvhDnl92WpajPqRNP1y5Hy22/o +Bj58JheezNsY6dxrGczETLd5dSJiXnO0dVvN51Jo6ZtTCgSq+BqnM/5gCLlycJJp9ij EXaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=iJZDKRrqLCwZUSrK5cuI09gW5LR76uz4+Sy12Ze3jIo=; b=L3BBXIPsPKQri4e/e3sfbXVzkOU9vr76ifftlRAWgzx/BItcswXVEAdKY79yvZADz4 PFjxCSiphO70Ly+l7Ppxjfi7rBa9x7c75fwxEgCDf85tfbaje8NGeyk0W/5R+1rY4aoz IbS9Z9ybHuftzNPJVwIyon3Ud8o1QmbK8304+A1jDJRUKEMBu7gC6/2jNTlgR9EKgh7e /IYVXgKwmv7QHzoBWCZv5BnJndwV1F560ypmsbGRoDg3ywMzb17/h1DdzevPcAYjWvNX dqG+2FyXaKsftn8WwqWphuPvESn/1ytTDGzSAQmYCsguw0T5W+aKk57Z9qefJU9a8dRl pXFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=jUHow3wv; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id w74si5453249pfj.89.2018.02.12.01.46.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 01:46:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=jUHow3wv; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A5E586E17C; Mon, 12 Feb 2018 09:45:21 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelnx194.ext.ti.com (lelnx194.ext.ti.com [198.47.27.80]) by gabe.freedesktop.org (Postfix) with ESMTPS id E8D6F6E164 for ; Mon, 12 Feb 2018 09:45:19 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1C9jHM9007801; Mon, 12 Feb 2018 03:45:17 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1518428717; bh=kVmT8/MWH6dewBrnN25F39d2MtzqI3WKIb5UVpD6pr0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=jUHow3wvDX3NWO98ub81SNcYYVGJ+OS4qdsWzdZDVvqq2obGxa/IAswQUwASWtBd6 MEOJT9eZkV4ZNF7qzkp7Hcppd/tYX5DfGse+KCSlKJRmbJo+zAYBzUDrTpUhBW2aJI qQ/HbUJft9E3bqFtM2exdJ7hOMOW9dTmckrdKBHM= Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9jHWD019658; Mon, 12 Feb 2018 03:45:17 -0600 Received: from DFLE106.ent.ti.com (10.64.6.27) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 12 Feb 2018 03:45:17 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 12 Feb 2018 03:45:17 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9j0N5003439; Mon, 12 Feb 2018 03:45:15 -0600 From: Tomi Valkeinen To: , Laurent Pinchart , Peter Ujfalusi , Jyri Sarha , Benoit Parrot Subject: [PATCH 08/24] drm/omap: Separate the dssdevs array setup from the connect function Date: Mon, 12 Feb 2018 11:44:38 +0200 Message-ID: <1518428694-18018-9-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> References: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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: Tomi Valkeinen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Peter Ujfalusi In order to ease up on the logic, break the current code to gather the dssdevs: first get all available dssdevs, then call connect on each dssdev. As the last step remove the dssdevs which failed to connect from the available dssdev list. Signed-off-by: Peter Ujfalusi Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/omap_drv.c | 54 ++++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index 869a8ab6aa4e..b5061fc7241a 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -165,34 +165,60 @@ static void omap_disconnect_dssdevs(struct drm_device *ddev) priv->num_dssdevs = 0; } -static int omap_connect_dssdevs(struct drm_device *ddev) +static void omap_collect_dssdevs(struct drm_device *ddev) { struct omap_drm_private *priv = ddev->dev_private; struct omap_dss_device *dssdev = NULL; - int r; + + for_each_dss_dev(dssdev) { + omap_dss_get_device(dssdev); + priv->dssdevs[priv->num_dssdevs++] = dssdev; + if (priv->num_dssdevs == ARRAY_SIZE(priv->dssdevs)) { + /* To balance the 'for_each_dss_dev' loop */ + omap_dss_put_device(dssdev); + break; + } + } +} + +static int omap_connect_dssdevs(struct drm_device *ddev) +{ + struct omap_drm_private *priv = ddev->dev_private; + u32 working = 0; + int r, i, j; if (!omapdss_stack_is_ready()) return -EPROBE_DEFER; - for_each_dss_dev(dssdev) { + omap_collect_dssdevs(ddev); + + for (i = 0; i < priv->num_dssdevs; i++) { + struct omap_dss_device *dssdev = priv->dssdevs[i]; + r = dssdev->driver->connect(dssdev); - if (r == -EPROBE_DEFER) { - omap_dss_put_device(dssdev); + if (r == -EPROBE_DEFER) goto cleanup; - } else if (r) { + else if (r) dev_warn(dssdev->dev, "could not connect display: %s\n", - dssdev->name); + dssdev->name); + else + working |= BIT(i); + } + + /* Remove the dssdevs if their connect failed */ + j = 0; + for (i = 0; i < priv->num_dssdevs; i++) { + if (working & BIT(i)) { + if (j != i) + priv->dssdevs[j] = priv->dssdevs[i]; + j++; } else { - omap_dss_get_device(dssdev); - priv->dssdevs[priv->num_dssdevs++] = dssdev; - if (priv->num_dssdevs == ARRAY_SIZE(priv->dssdevs)) { - /* To balance the 'for_each_dss_dev' loop */ - omap_dss_put_device(dssdev); - break; - } + omap_dss_put_device(priv->dssdevs[i]); } } + priv->num_dssdevs = j; + return 0; cleanup: From patchwork Mon Feb 12 09:44:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 127960 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3040323ljc; Mon, 12 Feb 2018 01:45:53 -0800 (PST) X-Google-Smtp-Source: AH8x225XKrUmtzJT9glmrKReOjq6aHkDgyg4DKCRGrIflP8J60fXy7qUlTgr90X/H2mg7IKweR9P X-Received: by 10.101.64.193 with SMTP id u1mr9082351pgp.24.1518428752919; Mon, 12 Feb 2018 01:45:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518428752; cv=none; d=google.com; s=arc-20160816; b=YS1RRDWQEMl+cr+p1L9Kc3F9evFONUOZk0Fct/czIrpcAFjw0VdBLaz/G4h29MRyK/ 4TLulYUso5S/PUxZPfIURW8Z+3krOZD/borPlbRG+E5IWhj+ykz2VOGSmESxn9uyV2pA qqGSttXF4ykN8rl+CoXkn/3isn2djEjIbOHUc+01td/8kXnm0Fbq4WJEaP+ao5RRXTT5 n9onDmdSIEaDPytGYtBCtWma2acrYblh04EydEvTx7vBrXBWzI4apVF0XfA//pqN2W7A x9+TAFaIXE9x++WgAWMtTX2iMpse1tfIkaRYk9luFkh25kx14opeRsiiFOpoyxgaPQ/H 9S5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=yaFlqxCr52R3IC5Re1Am7q2zeMEim2MFCiTv0+ipOro=; b=CprZ3Tb0eh5m8OUVT7uz6wCZBeGu/8O7pF2okfQJll1doK0xmbxES5xmTAO7ky3glL 581374ly7MzU80ObXnQRK0mt2VJfmeoL6RJBxzXhLQg24q/kIOFpsfiVGliZt8N5bs76 SNOVDCKoltKO7gcY8zTBHwPi3H+iAe3DL+jpHnO0mKNJtW6ehRiigPaf922OSO6pju49 YPCSBb+4QUIbKGWNA3zgvsSScHhDrmc+Hl6SOAub/vZXObzPgqJzWtFTvgHUcC0nzCy2 bz+FwJ45cZh5IaSaIfnamSuKSolt9xGDatCNQJoAFYFTVFfaYcSli9WmWBdfcKkeCW0X N0/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=bwel7eAx; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id 9-v6si2149520ple.367.2018.02.12.01.45.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 01:45:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=bwel7eAx; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EDDD76E199; Mon, 12 Feb 2018 09:45:23 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllnx209.ext.ti.com (fllnx209.ext.ti.com [198.47.19.16]) by gabe.freedesktop.org (Postfix) with ESMTPS id C94096E17D for ; Mon, 12 Feb 2018 09:45:21 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1C9jJ7J018963; Mon, 12 Feb 2018 03:45:19 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1518428719; bh=Y6Tge/E0SFONnOXbZYqLXRk3Au5QaRDRYdJ1cSHluZE=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=bwel7eAxTx9iqb5QqfyOhaTL6tpv/mjSzoZ6EyGbBrHSQ8FX5MJtXU5yciiC0VsLs TstKNPFh6KybJx1k3DQ31eVsTT+zenKzyqlPFrOMIS/LIEsI8gb4IU+NLJJQvRruQv VrNE4mO6yZXkm6jth5X0/zN7lYTc+VEQHJU9tRAs= Received: from DLEE103.ent.ti.com (dlee103.ent.ti.com [157.170.170.33]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9jJpC019788; Mon, 12 Feb 2018 03:45:19 -0600 Received: from DLEE110.ent.ti.com (157.170.170.21) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 12 Feb 2018 03:45:19 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 12 Feb 2018 03:45:19 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9j0N6003439; Mon, 12 Feb 2018 03:45:17 -0600 From: Tomi Valkeinen To: , Laurent Pinchart , Peter Ujfalusi , Jyri Sarha , Benoit Parrot Subject: [PATCH 09/24] drm/omap: Do dss_device (display) ordering in omap_drv.c Date: Mon, 12 Feb 2018 11:44:39 +0200 Message-ID: <1518428694-18018-10-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> References: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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: Tomi Valkeinen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Peter Ujfalusi Sort the dssdev array based on DT aliases. With this change we can remove the panel ordering from dss/display.c and have all sorting related to dssdevs in one place. Signed-off-by: Peter Ujfalusi Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/omapdrm/dss/display.c | 2 ++ drivers/gpu/drm/omapdrm/dss/omapdss.h | 1 + drivers/gpu/drm/omapdrm/omap_drv.c | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+) diff --git a/drivers/gpu/drm/omapdrm/dss/display.c b/drivers/gpu/drm/omapdrm/dss/display.c index 424143128cd4..3ef99f344bd3 100644 --- a/drivers/gpu/drm/omapdrm/dss/display.c +++ b/drivers/gpu/drm/omapdrm/dss/display.c @@ -52,6 +52,8 @@ int omapdss_register_display(struct omap_dss_device *dssdev) if (id < 0) id = disp_num_counter++; + dssdev->alias_id = id; + snprintf(dssdev->alias, sizeof(dssdev->alias), "display%d", id); /* Use 'label' property for name, if it exists */ diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h index 4222661d4c88..bd5f174a3c56 100644 --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h @@ -478,6 +478,7 @@ struct omap_dss_device { /* alias in the form of "display%d" */ char alias[16]; + int alias_id; enum omap_display_type type; enum omap_display_type output_type; diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index b5061fc7241a..877c3749f69b 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -15,6 +15,8 @@ * this program. If not, see . */ +#include +#include #include #include @@ -165,6 +167,18 @@ static void omap_disconnect_dssdevs(struct drm_device *ddev) priv->num_dssdevs = 0; } +static int omap_compare_dssdevs(const void *a, const void *b) +{ + const struct omap_dss_device *dssdev1 = *(struct omap_dss_device **)a; + const struct omap_dss_device *dssdev2 = *(struct omap_dss_device **)b; + + if (dssdev1->alias_id > dssdev2->alias_id) + return 1; + else if (dssdev1->alias_id < dssdev2->alias_id) + return -1; + return 0; +} + static void omap_collect_dssdevs(struct drm_device *ddev) { struct omap_drm_private *priv = ddev->dev_private; @@ -179,6 +193,10 @@ static void omap_collect_dssdevs(struct drm_device *ddev) break; } } + + /* Sort the list by DT aliases */ + sort(priv->dssdevs, priv->num_dssdevs, sizeof(priv->dssdevs[0]), + omap_compare_dssdevs, NULL); } static int omap_connect_dssdevs(struct drm_device *ddev) From patchwork Mon Feb 12 09:44:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 127966 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3040676ljc; Mon, 12 Feb 2018 01:46:27 -0800 (PST) X-Google-Smtp-Source: AH8x226Q2k4WkD0ive79baWsGZRWw/vxBR/OPNmxnBag9OhcvzUGqzddD9slG4yIzPnxeShLLjHD X-Received: by 10.101.65.9 with SMTP id w9mr8932900pgp.214.1518428786944; Mon, 12 Feb 2018 01:46:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518428786; cv=none; d=google.com; s=arc-20160816; b=fin/4X6z5xCkh5nFvPLyvpswqdK/zKMsADIN4BzhN8SrDHjHmMDyv6tPx7sloOuwRR +4raF2v6+9Ewt0YAEFHJHMO1qDKSm6Gl6dFcAnwKx7eYUMGSA9v/Jtv8AW7/LWxEKDRw ZYab1vkSZD/ItWtaxERHLgX0eCydhPMakSyI4gaD70OyZlkjthlt7bizOBa8gwLj0E6b UkCnRh5BAFLruH82/zsahMNQJABPZPpr/Rll6PQVBrN502PA5aBpmsSduQrlhOz8JPtW biJvY53Lii02vR4nAnioRrlKldsU2fbC+CVqzMvdyVS6hVM4JTvhP4vjjZchnMSctuNa xCvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=EGxz7LOcf4bNnOr38eLREaA42tGKtx5A9UQnQoxZGHM=; b=OdT23xEr/ejJWOm5jMZkdr9hC6eV1y5BlaAKiLeVr4RsXA5DaenNFM8G3J3Zeno4vP aU13xYHNP8D3ZexaEQFT2YT5rHB5YAk0fuP0C9920UXORmyjbQR6rrdih6oHQJTnR6OA 8Yj+SEIALkfqDNcUiH7yeGlyD/2wUlY/iIhCU+6x8wZPZXNCWuWoaQIhxo9HeLH2J+8o Fi8N5ZCTkr9pVe8iUoKsPJ36Ksn04CkBRZqKn/+Zl5ILZBmDe2TGGKq50VM83P3EGjCv Ko6zL4g7i1TAj9jGbB+makzCNQp9UkDFI2mIiI5lvLZL29JajaAududa0HGKBvk2mkSv Us1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=iwAI+Y44; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id 30-v6si5671099plc.548.2018.02.12.01.46.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 01:46:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=iwAI+Y44; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E52136E1A6; Mon, 12 Feb 2018 09:45:25 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelnx193.ext.ti.com (lelnx193.ext.ti.com [198.47.27.77]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8A0436E1A6 for ; Mon, 12 Feb 2018 09:45:24 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1C9jLkG016026; Mon, 12 Feb 2018 03:45:21 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1518428722; bh=wawGVfmdP4jIPZJhy0eD9xNunOlCLNCPeKUOpvA77X4=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=iwAI+Y44tPHIrBSZFWu7JGyMg2/3z58xG2HuH/EhKizwJVS6dFWrgB0G5DuP06o2j MHzDg57nKio7di7kTl0YgmUhcU+6RXF3bBV2QPCJHu0jcLsoQpi2NWhudDnHji4sNu uwp4aZn4WWGTI+KPN5CgMyNa+2v4h/2ebyyC6Rkc= Received: from DFLE100.ent.ti.com (dfle100.ent.ti.com [10.64.6.21]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9jLvM018856; Mon, 12 Feb 2018 03:45:21 -0600 Received: from DFLE113.ent.ti.com (10.64.6.34) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 12 Feb 2018 03:45:20 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 12 Feb 2018 03:45:21 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9j0N7003439; Mon, 12 Feb 2018 03:45:19 -0600 From: Tomi Valkeinen To: , Laurent Pinchart , Peter Ujfalusi , Jyri Sarha , Benoit Parrot Subject: [PATCH 10/24] drm/omap: dss: Remove display ordering from dss/display.c Date: Mon, 12 Feb 2018 11:44:40 +0200 Message-ID: <1518428694-18018-11-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> References: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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: Tomi Valkeinen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Peter Ujfalusi The previous patch implements the ordering of the dss_devices based on DT aliases in omap_drm.c, so there is no need to do the ordering in dss/display.c anymore. At the same time remove the alias member of the omap_dss_device struct since it is no longer needed. The only place it was used is in the omapdss_register_display() function. Signed-off-by: Peter Ujfalusi Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/dss/display.c | 15 +++------------ drivers/gpu/drm/omapdrm/dss/omapdss.h | 2 -- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/display.c b/drivers/gpu/drm/omapdrm/dss/display.c index 3ef99f344bd3..7840837f4325 100644 --- a/drivers/gpu/drm/omapdrm/dss/display.c +++ b/drivers/gpu/drm/omapdrm/dss/display.c @@ -41,7 +41,6 @@ static int disp_num_counter; int omapdss_register_display(struct omap_dss_device *dssdev) { struct omap_dss_driver *drv = dssdev->driver; - struct list_head *cur; int id; /* @@ -54,26 +53,18 @@ int omapdss_register_display(struct omap_dss_device *dssdev) dssdev->alias_id = id; - snprintf(dssdev->alias, sizeof(dssdev->alias), "display%d", id); - /* Use 'label' property for name, if it exists */ of_property_read_string(dssdev->dev->of_node, "label", &dssdev->name); if (dssdev->name == NULL) - dssdev->name = dssdev->alias; + dssdev->name = devm_kasprintf(dssdev->dev, GFP_KERNEL, + "display%d", id); if (drv && drv->get_timings == NULL) drv->get_timings = omapdss_default_get_timings; mutex_lock(&panel_list_mutex); - list_for_each(cur, &panel_list) { - struct omap_dss_device *ldev = list_entry(cur, - struct omap_dss_device, - panel_list); - if (strcmp(ldev->alias, dssdev->alias) > 0) - break; - } - list_add_tail(&dssdev->panel_list, cur); + list_add_tail(&dssdev->panel_list, &panel_list); mutex_unlock(&panel_list_mutex); return 0; } diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h index bd5f174a3c56..ac8ca37ff889 100644 --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h @@ -476,8 +476,6 @@ struct omap_dss_device { struct list_head panel_list; - /* alias in the form of "display%d" */ - char alias[16]; int alias_id; enum omap_display_type type; From patchwork Mon Feb 12 09:44:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 127968 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3040723ljc; Mon, 12 Feb 2018 01:46:33 -0800 (PST) X-Google-Smtp-Source: AH8x226ghQt7qYrtw1Wg0xHXalr+1yp9ihVncCNBNErESwdCiGUXMIGhorPo+wX3RZtnIs7YIW2p X-Received: by 2002:a17:902:7c98:: with SMTP id y24-v6mr10131488pll.305.1518428792936; Mon, 12 Feb 2018 01:46:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518428792; cv=none; d=google.com; s=arc-20160816; b=SFMrQf7lwOXDr4/53DMwPGEHuHWzKJq6NhhD55XMKvjmtDNCedn5OvmVc7scOyqpd0 ZRZfRYZW1I4ySVETKNI57gNSiaEDCanAito7HRB6iNzOLG3qOsEPHB+f8zuEhD4uX9zD tGVdIoDC6iRCIleV4uococ6FB8jz0Eo1B/IuhakqCftd+YNnQeU4yyoIyFpi4tjJ84yy xCUp62aRf29jkO96wtEg1/5TrDAArB1EQci3DZU8uD5s1/6EK96JecOYlo1dwVXiBC8i 0S05SAkwWB1YbHD6ZYf+tlbDjACgu29nzDoEpPcLwiecvtFddSOcFIiW4y+brPvn+Q1W d4LQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=2w0Wxj3dAF0WZZem2jFE6v/2bwQhW6VP0+YIPj3nxrw=; b=t0fAqWi5JHStTYcn9NWM4QSzBl84zfg0dAvWAv3lDhBplPOy7V8vEW3X1+zetE/XMQ WakOze94fXeRaVqKLouwD94peHjhusplEsiEgnsLC6Eh5rz1Wew8TogXc6/hmrjWHyso z80DG1vI60jzHshrGTtwHYM7JGr3NIC9NQoWS+qOaAYzKGOEsO1mHgtbH3DiQw2JVkH1 CYeCI3ttyCByI/TirBGjEbNrVJTHhF3WynDSJK9fC7Qis3I0yNpGY49098tiO8DtOZjC p68f56rYcWkqme6BdYaB0k26/4ojThrCna5cS706Hqf4VSYRXasdtqAYJ6mskFIIlyV1 pjQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=lPQgY6Pw; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id l20si6145789pfa.253.2018.02.12.01.46.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 01:46:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=lPQgY6Pw; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 102F06E1AF; Mon, 12 Feb 2018 09:45:29 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelnx194.ext.ti.com (lelnx194.ext.ti.com [198.47.27.80]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8817B6E1A6 for ; Mon, 12 Feb 2018 09:45:25 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1C9jNn1007853; Mon, 12 Feb 2018 03:45:23 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1518428723; bh=Qz8aCPCUmcpxCCPDDiI1Dt4Wknx3D2Yf5ZQzfRX96bY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=lPQgY6PwGZtXtD8gZMbJ7Yh9N6jCcdEfa6Kb2LJo78bpYWAb0kLgj+zuVtW0kU63s lJUQ27XvHjUjqi2Qe65yhDjGhNGfk3D/JsjQxAf0FKRM9VvBfpq8nWMp0ZyGXWJ76r Rujjj8q9HIVp4fjYJ2jDLGVhBMgu/y32HrRsvnyU= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9jN3I019931; Mon, 12 Feb 2018 03:45:23 -0600 Received: from DLEE107.ent.ti.com (157.170.170.37) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 12 Feb 2018 03:45:22 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 12 Feb 2018 03:45:22 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9j0N8003439; Mon, 12 Feb 2018 03:45:21 -0600 From: Tomi Valkeinen To: , Laurent Pinchart , Peter Ujfalusi , Jyri Sarha , Benoit Parrot Subject: [PATCH 11/24] drm/omap: Add kernel parameter to specify the desired display order Date: Mon, 12 Feb 2018 11:44:41 +0200 Message-ID: <1518428694-18018-12-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> References: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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: Tomi Valkeinen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Peter Ujfalusi omapdrm.displays (int array) can be used to reorder the displays by id if needed. It can be also used to disable display. If the board have two active displays: 0 - LCD 1 - HDMI then: omapdrm.displays=0,1 - represents the original order (LCD, HDMI) omapdrm.displays=1,0 - represents reverse order (HDMI, LCD) omapdrm.displays=0 - only the LCD is enabled omapdrm.displays=1 - only the HDMI is enabled omapdrm.displays=-1 - disable all displays Signed-off-by: Peter Ujfalusi Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/omap_drv.c | 55 +++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index 877c3749f69b..5a27a47b628e 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -34,6 +34,14 @@ #define DRIVER_MINOR 0 #define DRIVER_PATCHLEVEL 0 +#define MAX_NR_DISPLAYS 8 +static int display_order[MAX_NR_DISPLAYS]; +static int display_order_nelm; +module_param_array_named(displays, display_order, int, &display_order_nelm, + 0444); +MODULE_PARM_DESC(displays, + "ID array to specify the order of the active displays"); + /* * mode config funcs */ @@ -182,12 +190,21 @@ static int omap_compare_dssdevs(const void *a, const void *b) static void omap_collect_dssdevs(struct drm_device *ddev) { struct omap_drm_private *priv = ddev->dev_private; + struct omap_dss_device *dssdevs[ARRAY_SIZE(priv->dssdevs)]; struct omap_dss_device *dssdev = NULL; + int num_dssdevs = 0; + unsigned long dssdev_mask = 0; + int i; + + /* No displays should be enabled */ + if (display_order_nelm == 1 && display_order[0] < 0) + return; for_each_dss_dev(dssdev) { omap_dss_get_device(dssdev); - priv->dssdevs[priv->num_dssdevs++] = dssdev; - if (priv->num_dssdevs == ARRAY_SIZE(priv->dssdevs)) { + set_bit(num_dssdevs, &dssdev_mask); + dssdevs[num_dssdevs++] = dssdev; + if (num_dssdevs == ARRAY_SIZE(dssdevs)) { /* To balance the 'for_each_dss_dev' loop */ omap_dss_put_device(dssdev); break; @@ -195,8 +212,38 @@ static void omap_collect_dssdevs(struct drm_device *ddev) } /* Sort the list by DT aliases */ - sort(priv->dssdevs, priv->num_dssdevs, sizeof(priv->dssdevs[0]), - omap_compare_dssdevs, NULL); + sort(dssdevs, num_dssdevs, sizeof(dssdevs[0]), omap_compare_dssdevs, + NULL); + + /* Do ordering based on the display_order parameter array */ + for (i = 0; i < display_order_nelm; i++) { + int old_index = display_order[i]; + + if ((old_index >= 0 && old_index < num_dssdevs) && + (dssdev_mask & BIT(old_index))) { + priv->dssdevs[priv->num_dssdevs++] = dssdevs[old_index]; + clear_bit(old_index, &dssdev_mask); + } else { + dev_err(ddev->dev, + "Ignoring invalid displays module parameter\n"); + priv->num_dssdevs = 0; + break; + } + } + + /* if the target list is empty, copy the collected dssdevs, if any */ + if (priv->num_dssdevs == 0) { + for (i = 0; i < num_dssdevs; i++) + priv->dssdevs[i] = dssdevs[i]; + + priv->num_dssdevs = num_dssdevs; + } else { + u32 idx; + + /* check if we have dssdev which is not carried over */ + for_each_set_bit(idx, &dssdev_mask, ARRAY_SIZE(dssdevs)) + omap_dss_put_device(dssdevs[idx]); + } } static int omap_connect_dssdevs(struct drm_device *ddev) From patchwork Mon Feb 12 09:44:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 127970 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3040816ljc; Mon, 12 Feb 2018 01:46:41 -0800 (PST) X-Google-Smtp-Source: AH8x226tO8QP5WnulfdwBzy8Uo+IYMafVWwKRr6ZPfnU0DXvYANO2bnm+mlNKakz8Mej0EgFwJMI X-Received: by 2002:a17:902:51e9:: with SMTP id y96-v6mr10163058plh.344.1518428800984; Mon, 12 Feb 2018 01:46:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518428800; cv=none; d=google.com; s=arc-20160816; b=KJtfnFuvC8rDnPWTJEtI84Gbg2pR4Dz9xrVD4/pK3IZAO7VAVtalmv/8WUjjkUsZ+o 8Mq3eWb4LIc1cOmw6UedYZqxyaBz+SXqoCGarBnqCkxPKGE9RueR2ixL26THWVr29Ycp nQ4fUNSl3lFaUebJGVc0gRusesQbsB5swhtbm6aOqmiLe3tToYIEr+Evnuz0aPUz9P9Y E1q6qPfzQaDxQwjxYyuYBmzsTVjvaGIE8+5U630mg5OBAtHEKd0l25WHPACsOGaqyP20 xS8CcfuTSjQ6rn6l/LJRXRqqebPhCq4s9PPR4x+Q25FQv3ykTsEF0lIq7eV3L7Jrw0dt bdCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=V5c2VLgiF8SXn7QDSW5tYvUcFuVecUndZk7NLnyTxS4=; b=lPa1+18vs1/8NAvsb68p8BANHyfagKsUK6k2vd4GmjHjY3GuhMKQdjxWCSlWkSjkXt OF+dZa3/Trp2gYpT5JBJiRqdO1/q4z//xvcm5MEoq/AjN4CAK/dDupom8winYxYNgUSd XFD2fSLoUMNOt/oGqMunwhVVovqO4lUIXONQGD2wueCfHy9+NDsNyXfVio3hCrIRoZnv VgHMJo+EYblwM+TZs/GEAYEtPsJ4t1FPpdzBXH4O6lb+cbOcgfLX9XXidgGQCYzU4Ikk 1MV4UMKXlOVlhEfEsKjbqggDyGnM0qUdyiqO9LzO2XGt9/05JXZnYCQTQ21R04wuUIXx hYeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=ytKEKuOk; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id c74si6085531pfj.339.2018.02.12.01.46.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 01:46:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=ytKEKuOk; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 353EF6E1B0; Mon, 12 Feb 2018 09:45:29 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelnx194.ext.ti.com (lelnx194.ext.ti.com [198.47.27.80]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4BF276E1AE for ; Mon, 12 Feb 2018 09:45:27 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1C9jPrx007857; Mon, 12 Feb 2018 03:45:25 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1518428725; bh=XTNRtdIrQtp2bblpzUDIDKS9twjwi+0XD7XtM/+hm5I=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=ytKEKuOk7xcUm3i0WZGJpcV6DNfXsh3vKnuky6WepaQjMepXyT5gI7Adhy5d3hzY+ lQnKoBPG/cyWQgC118BIC+r9EcwP5+dJn6LOA25LwTfrF5+km+L7BMOVbbF1P3Mj56 62eal745/EmKYEoxlOyQco46AzOOmTlb+xynx6sM= Received: from DFLE103.ent.ti.com (dfle103.ent.ti.com [10.64.6.24]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9jP7d018930; Mon, 12 Feb 2018 03:45:25 -0600 Received: from DFLE115.ent.ti.com (10.64.6.36) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 12 Feb 2018 03:45:24 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 12 Feb 2018 03:45:24 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9j0N9003439; Mon, 12 Feb 2018 03:45:23 -0600 From: Tomi Valkeinen To: , Laurent Pinchart , Peter Ujfalusi , Jyri Sarha , Benoit Parrot Subject: [PATCH 12/24] drm/omap: Init fbdev emulation only when we have displays Date: Mon, 12 Feb 2018 11:44:42 +0200 Message-ID: <1518428694-18018-13-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> References: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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: Tomi Valkeinen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Peter Ujfalusi Do not try to init the fbdev if either num_crtcs or num_connectors is 0. In this case we do not have display so the fbdev init would fail anyways. Signed-off-by: Peter Ujfalusi Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/omapdrm/omap_fbdev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c index 30ce3d562414..509283af5b0c 100644 --- a/drivers/gpu/drm/omapdrm/omap_fbdev.c +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c @@ -249,6 +249,9 @@ void omap_fbdev_init(struct drm_device *dev) struct drm_fb_helper *helper; int ret = 0; + if (!priv->num_crtcs || !priv->num_connectors) + return; + fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL); if (!fbdev) goto fail; From patchwork Mon Feb 12 09:44:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 127964 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3040581ljc; Mon, 12 Feb 2018 01:46:16 -0800 (PST) X-Google-Smtp-Source: AH8x224dfdpR18SWLTo2Ii1L6d8/Xt/150i3tUrXC/zyvVMjKO7K+1vLgkrRhBhMPylTa+n0HDzy X-Received: by 2002:a17:902:bb8d:: with SMTP id m13-v6mr10290622pls.49.1518428776482; Mon, 12 Feb 2018 01:46:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518428776; cv=none; d=google.com; s=arc-20160816; b=Asc+WEUJkCKp+YOwgAaYS+PJDLLNloQpbTCpT7Svh5eUmNTtYJmlc28YhdkKuajBQF s02gi7V5eVXIJ63VDwWMQbRaIANQUhns4OuCGOkyrIWFgaa1yMH6rHkrghU7tyngrDdZ CQzNImeEXGZToQgxizARRc4tqf+ZVn6e1Ru2uOaRyWWAVn4KAtCLPShY6KB3JMJfEQeG d/WGtV/mxRe1aQ8VabKGg0K8ppdEBWGlB+9PfObDsG4PkY4CmLFsTTMSK2FkHlEtUIm/ XPPPCtnCOh9flxNoT2BW2F4QXntD305g3VvzRlHlHxJJIq96CA+LJCWf1yttRout+Khq Ht4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=mQ1X699yHqjDG31X1YOTTB94CzG8zBY7SE1U5wx+t74=; b=Psu0PXEJnrD4dppfhkMUxffy3v3860WfoHD2sksCDPz1RrRuAFmwNsNpCd1GTa18se ElBtaK++4TMUGPuW4HbLU7QX6SLc1ejGL0+/5BSBL2YsbKXzkoqriOEFCB7r5tlhv0Q1 kfTeVJnBKkotaFdQW8EmkCxFts8/pOP+GKD4JqwzlKtrvuSh51vUT3u9+TMjE57gWD9c VJaKgopon4FSC+OBiSK8NTltn8BFJFFaepsdaevA4RBLZy/Neyz1GMDBsoz5QxDsBgus Y01sjJN1s3l4j07B32EBvGz03qal6XWG1LAu1O9uFSLTC6vQmRMzs2HQLJn+sRItxqOV 5CBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=sCpqtDew; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id x4si6055610pfx.114.2018.02.12.01.46.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 01:46:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=sCpqtDew; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 463956E1C7; Mon, 12 Feb 2018 09:45:31 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllnx209.ext.ti.com (fllnx209.ext.ti.com [198.47.19.16]) by gabe.freedesktop.org (Postfix) with ESMTPS id 754E36E1BB for ; Mon, 12 Feb 2018 09:45:29 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1C9jRF4018978; Mon, 12 Feb 2018 03:45:27 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1518428727; bh=L2AGFWFqTzLMFPNGbx7sDiZ660vFR0qCjouFaPCHXeM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=sCpqtDewyavaopZQJFiS6skNqQhl92eaLM4ifOjXQua+N50rW+GT6DKddW+8wIiVl HNA6UWrPumPgbFoDFKbM/C2QFrDLiAz+W7oijEx+mABzvtvBrz9qZ5yiG56kcSgqAP JYx/ItLF9vtwbFJZEcE9lLds+pY4vGzmWxxKg1cs= Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9jReg020017; Mon, 12 Feb 2018 03:45:27 -0600 Received: from DFLE100.ent.ti.com (10.64.6.21) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 12 Feb 2018 03:45:26 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 12 Feb 2018 03:45:26 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9j0NA003439; Mon, 12 Feb 2018 03:45:25 -0600 From: Tomi Valkeinen To: , Laurent Pinchart , Peter Ujfalusi , Jyri Sarha , Benoit Parrot Subject: [PATCH 13/24] drm/omap: remove leftover enums Date: Mon, 12 Feb 2018 11:44:43 +0200 Message-ID: <1518428694-18018-14-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> References: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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: Tomi Valkeinen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" A few enums are not used anywhere, so remove them. Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/omapdrm/dss/omapdss.h | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h index ac8ca37ff889..51aefd80bcd4 100644 --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h @@ -159,21 +159,6 @@ enum omap_overlay_caps { OMAP_DSS_OVL_CAP_REPLICATION = 1 << 5, }; -enum omap_dss_clk_source { - OMAP_DSS_CLK_SRC_FCK = 0, /* OMAP2/3: DSS1_ALWON_FCLK - * OMAP4: DSS_FCLK */ - OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC, /* OMAP3: DSI1_PLL_FCLK - * OMAP4: PLL1_CLK1 */ - OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI, /* OMAP3: DSI2_PLL_FCLK - * OMAP4: PLL1_CLK2 */ - OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC, /* OMAP4: PLL2_CLK1 */ - OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI, /* OMAP4: PLL2_CLK2 */ -}; - -enum omap_hdmi_flags { - OMAP_HDMI_SDA_SCL_EXTERNAL_PULLUP = 1 << 0, -}; - enum omap_dss_output_id { OMAP_DSS_OUTPUT_DPI = 1 << 0, OMAP_DSS_OUTPUT_DBI = 1 << 1, From patchwork Mon Feb 12 09:44:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 127965 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3040626ljc; Mon, 12 Feb 2018 01:46:20 -0800 (PST) X-Google-Smtp-Source: AH8x226cqPVHYfIVLV/4Uazol9reDJz/umf2+sbdKlyXxE2xwmhl0v4fqqVuoyx3NM1Az1xyfICV X-Received: by 2002:a17:902:424:: with SMTP id 33-v6mr10069453ple.57.1518428780734; Mon, 12 Feb 2018 01:46:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518428780; cv=none; d=google.com; s=arc-20160816; b=fmi7iVJ21t0fRFIDXHsyzAAN2xnUf0KXFq0hlbEUD1DDZeD4NUUVoh2fuambR5/GTz tpb/uMiLfO7uPs4VG+dAZ1HzQD6uWJjWpFLUCVYDFHwgTGFrG4g3rUnbbUwOXxRQEriH EBASbX645SBVisejPeZ+bcDKQiiEs1uBu1mUGipRAIhpJ9ngFbkcdPOIY/dkH9A35Jlx QueEnNf4ySUtfgsg0Ko8/jC62HFNbK9vtPbAz0VtczB5uddmF+Tpi2jC8R2Fd15OraQj p9ppqotGm3c46wxLdTgwsld9t67iRU508YMzYuZoiAVvVCDZdOrgG2dKKeGpoDJKURwF DMyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=v9Mdp9OgCO6ZnrsYdFV0lzb/cdPNgBjRcx3JFZW1qMo=; b=WZ0/U0sOWaa9Bxktx8zL1GqNm7SJgq+WMHZxWPYbmQ3rCNETjWW3GKvfw2jZlhC1xh Pj5h5cG9oL9OBHYcRddNhpNs2RV0l1rtg9oZvGsGlt1goc41w3aT6qA+mGRYrBNXCH7/ niYOkCnQVmWng4xbCFdVtl0pHZx4xpPsq6W203kmnYBSVtODYCxgpvQKr+ySiuY/tCm7 8uTmQNoWcHVp8Y7LQ7NAzRaXzk1kzUkjRGkGw4W/GB57RgmMfPXOzgi+n6ZAv8/qRZyL af6feA+ggiyu5jPZeXFx66cvj/akbh7CMnywtZ575l7A3x+Dl01PLFGJ9u65SdnFCfk4 M7Zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=QdEHxSlo; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id l14si1950666pff.308.2018.02.12.01.46.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 01:46:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=QdEHxSlo; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 329486E1CA; Mon, 12 Feb 2018 09:45:33 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelnx194.ext.ti.com (lelnx194.ext.ti.com [198.47.27.80]) by gabe.freedesktop.org (Postfix) with ESMTPS id 49A496E1C8 for ; Mon, 12 Feb 2018 09:45:31 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1C9jSJD007863; Mon, 12 Feb 2018 03:45:29 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1518428729; bh=BxT6nz6vXLLIBQcwWPzwf80H4ovmLucWDLUMu32MUt8=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=QdEHxSlo3zM2Tzhf2C5EZY1H7CIgnSKcp7GXQ3L4fT8QLQCeOf9F3tR8QsxeKCeyU 50pS8jMnomBGUHHfYhVjR0fCAntdPOXFhsw+2S4I0D9wOga/1Ndd7qJC1E1knKU7d8 SI/DsaqaCZF30/8SaLe6kcl70M0wRlPlvg9CvJ7c= Received: from DLEE111.ent.ti.com (dlee111.ent.ti.com [157.170.170.22]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9jSeQ020079; Mon, 12 Feb 2018 03:45:28 -0600 Received: from DLEE110.ent.ti.com (157.170.170.21) by DLEE111.ent.ti.com (157.170.170.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 12 Feb 2018 03:45:28 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 12 Feb 2018 03:45:28 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9j0NB003439; Mon, 12 Feb 2018 03:45:27 -0600 From: Tomi Valkeinen To: , Laurent Pinchart , Peter Ujfalusi , Jyri Sarha , Benoit Parrot Subject: [PATCH 14/24] drm/omap: dispc: disp_wb_setup to check return code Date: Mon, 12 Feb 2018 11:44:44 +0200 Message-ID: <1518428694-18018-15-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> References: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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: Tomi Valkeinen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Benoit Parrot When dispc_wb_setup() calls dispc_ovl_setup_common() it does not check for failure but instead keeps on partially setting up WB. This causes the WB H/W to be partially initialized and yield unexpected behavior. Make sure return code is successful before proceeding. Signed-off-by: Benoit Parrot Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/omapdrm/dss/dispc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c index 679931e108f9..30bcee6580f5 100644 --- a/drivers/gpu/drm/omapdrm/dss/dispc.c +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c @@ -2678,6 +2678,8 @@ int dispc_wb_setup(const struct omap_dss_writeback_info *wi, wi->height, wi->fourcc, wi->rotation, zorder, wi->pre_mult_alpha, global_alpha, wi->rotation_type, replication, vm, mem_to_mem); + if (r) + return r; switch (wi->fourcc) { case DRM_FORMAT_RGB565: @@ -2718,7 +2720,7 @@ int dispc_wb_setup(const struct omap_dss_writeback_info *wi, REG_FLD_MOD(DISPC_OVL_ATTRIBUTES2(plane), wbdelay, 7, 0); } - return r; + return 0; } static int dispc_ovl_enable(enum omap_plane_id plane, bool enable) From patchwork Mon Feb 12 09:44:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 127972 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3040949ljc; Mon, 12 Feb 2018 01:46:54 -0800 (PST) X-Google-Smtp-Source: AH8x227CrA4oGTSOanFJu9/I1t8gDLV8VZyjm3JfBuVhTaUgRTovOntzGIZDp0xbi2QJm5iYvzw4 X-Received: by 2002:a17:902:5793:: with SMTP id l19-v6mr9797340pli.56.1518428814817; Mon, 12 Feb 2018 01:46:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518428814; cv=none; d=google.com; s=arc-20160816; b=pSehMCkMgLG/G+tPVMvQl63z7W1wYSpCbiNu+1YwacFTRxn12vM2gWE5cylcX74QDh Uq5aTr/J6vgDrJbeuohDb3EZuZKw4oEGlj2suiv8c2B7h6S/5BYOd8NQnFTfchG6wLi4 DLOIgfpsyGbgKK6zhgwrUcQXAsygGjxYG+fsEHXyMVnaxOufVtqQFBMVCwH/psO+rxfj qSCWL+4OMcawpxovoOdI3/WLewFKz93vQrAQYMvSlk2nXsOUTY0MxzXZE1JoPUkdwPth AFuGBV3dK0mlnuozlfQyz/K600wM4ueOywD6muOE+XNU4hj7KGJo2sHlVS5Wdo4ozsbj G3jQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=A3JNKvpSzBZa1iJyPNrwoZZ8KT0Bsr1GDxSduG81Xyw=; b=fO0TwaxmWC7hnwLmGrxrp5fYQCt81ifDCxxra1KBRXVuIMq9WB4GqAM+G5KVFc9fij gCqbCRXGYHdRz/6Fo2dqZOR35NyTrPQGVhT+GmvWHfpA171Prupsz+J2uHg0xlmSjWlN ukZxvANalG6EyahY9qZWWB6qnGWVysq9yHP46GelCr4eyqTJ0a1qvau8SVYeVrPoKwy+ VlUnCBQ4pAF4gjU9qIXWrqWRmBHq2xPbc7XPDgqN7I5GvLuoHdakkhgf29TEEZHEB/pn QXEBt+tDYYWM5aaqWV85eRvSGx/5G2hZY8HRMFZFYy1+xSn5KIGyhfrVIfJR+D0PfsLY BhvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=v+z1a7Ug; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id v11si2071066pgr.172.2018.02.12.01.46.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 01:46:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=v+z1a7Ug; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 857E06E1DB; Mon, 12 Feb 2018 09:45:34 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllnx209.ext.ti.com (fllnx209.ext.ti.com [198.47.19.16]) by gabe.freedesktop.org (Postfix) with ESMTPS id E3C566E1CD for ; Mon, 12 Feb 2018 09:45:32 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1C9jUJo018989; Mon, 12 Feb 2018 03:45:30 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1518428730; bh=4hllIcgJd93IoXhcJ69Y70nbcN/Un4F9ZcuRCzbpqXo=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=v+z1a7Ugn/VEVOsz4GV5U1yu0fXivqAk6y/4oYjxrZHSOyve3+TBeK3FPLc6IcWz9 v8xtjeGk9ZiHYtPLBslEPnCleSBQxCzJAw6wGkBNya9j+oBdlFbld9M1CXawTrp5JK FGtcO7dlUhYxy2P5VNVjNxHOjyA4LLBNqirM8sZI= Received: from DFLE100.ent.ti.com (dfle100.ent.ti.com [10.64.6.21]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9jUs8019057; Mon, 12 Feb 2018 03:45:30 -0600 Received: from DFLE109.ent.ti.com (10.64.6.30) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 12 Feb 2018 03:45:30 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 12 Feb 2018 03:45:30 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9j0NC003439; Mon, 12 Feb 2018 03:45:28 -0600 From: Tomi Valkeinen To: , Laurent Pinchart , Peter Ujfalusi , Jyri Sarha , Benoit Parrot Subject: [PATCH 15/24] drm/omap: Add pclk setting case when channel is DSS_WB Date: Mon, 12 Feb 2018 11:44:45 +0200 Message-ID: <1518428694-18018-16-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> References: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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: Tomi Valkeinen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Benoit Parrot In dispc_set_ovl_common() we need to initialize pclk to a valid value when we use WB in capture mode (i.e. mem_2_mem is false). Otherwise dispc_ovl_calc_scaling() fails. Signed-off-by: Benoit Parrot Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/dss/dispc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c index 30bcee6580f5..5e7bdff2821d 100644 --- a/drivers/gpu/drm/omapdrm/dss/dispc.c +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c @@ -2488,6 +2488,10 @@ static int dispc_ovl_setup_common(enum omap_plane_id plane, unsigned long pclk = dispc_plane_pclk_rate(plane); unsigned long lclk = dispc_plane_lclk_rate(plane); + /* when setting up WB, dispc_plane_pclk_rate() returns 0 */ + if (plane == OMAP_DSS_WB) + pclk = vm->pixelclock; + if (paddr == 0 && rotation_type != OMAP_DSS_ROT_TILER) return -EINVAL; From patchwork Mon Feb 12 09:44:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 127967 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3040693ljc; Mon, 12 Feb 2018 01:46:28 -0800 (PST) X-Google-Smtp-Source: AH8x226euHHLO8XO8ZeAuMrL9sVQsuEJUSLQ/LgTnkNa9zVmo1IlsZaJOhYhvI3PYnLxoj7u8g8T X-Received: by 2002:a17:902:3363:: with SMTP id a90-v6mr9967224plc.159.1518428788720; Mon, 12 Feb 2018 01:46:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518428788; cv=none; d=google.com; s=arc-20160816; b=P5/XQo0SsThYLH/ChIk84Vpkwc9UrwWiKeu4QSQf4/1UO5sOSQQS9UxXUqlt8xHsBy qIznz+tx/RK5+WlHXnn2eGSCTIbWd5CgYIcOCAY/A0FXdL3R2oHMzuwIcp1zFE4Mwya4 sHqDivqSPEc4AqgXu7aN/NfK78TvI2X+RXdcsXiV5MZeMG743KddU/7unxPzOggv/ZDa aBQCK1DhX3858Tbg+3XSIozEO6kyAa0yeHQssYH98z+sRVfu76jcWx2aip3NoEzwJM9G HkBLZzk5b/rWMug7/5vmMCKseD97Q3vAXOmnbxXYCrLpwc5/baXPbXopd/2TF3faNRWT MT1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=vucJ1EqB6t7IHeEQN/bD0K+MRCGjxhssmv8ZgKxoJ+o=; b=i/NA6kP7h1i9dz0j0HtAfcZ+BHlN46nUfi45C/Ql87pI5cwMzUS1jic89/X5SP5/5v gnDbKFPL1m9MR5mtZVjDUJbc1HgUABjNfKO2WFPbLaOec0XrUTvNPCLyiZEvQrE62WL8 yg+AvuPPA9vfpTZCtwgknycJISIjHcGG/FdChDGvCku0niPA5rR3Sxe1/VCxWSAagB8S CceGPvdC38gXfyZRMKMD51ZmGC01UrkoU+U60QvTHK1iFjQdyPRhw/z8TO5mIlgS54Mm 0vFyRwCHhYa18Ij7NJWC5oqeMDd3YKf8rJlAI6QDzzuvNPF1Sheo3YBzRVg0AaySeZlq +HXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=oYuwNbbH; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id p8-v6si5609375plk.192.2018.02.12.01.46.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 01:46:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=oYuwNbbH; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5462C6E0E4; Mon, 12 Feb 2018 09:45:38 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllnx210.ext.ti.com (fllnx210.ext.ti.com [198.47.19.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0A39D6E1E0 for ; Mon, 12 Feb 2018 09:45:34 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1C9jWcZ009892; Mon, 12 Feb 2018 03:45:32 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1518428732; bh=NHnGdMlfnnbZNqRRrdAOyltLqakFuPeAWWGVVQJcuqE=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=oYuwNbbHYJceiwmP0R05Qw0I5fOf4O/eo0rLyFVnHFIOtEAZP/l8GI/IL2hfQaE5L HH2ykEVY6JPtLj6ptf49mQdNBuo0q7P7jkNN5ikOLeV5ql+YMARAFc1RMUNX/0xB4V dgDkY6wEcbXJ7JF2e1ttC+wA0NGxaReo9gWVVeeE= Received: from DLEE107.ent.ti.com (dlee107.ent.ti.com [157.170.170.37]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9jWFT019151; Mon, 12 Feb 2018 03:45:32 -0600 Received: from DLEE115.ent.ti.com (157.170.170.26) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 12 Feb 2018 03:45:32 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 12 Feb 2018 03:45:32 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9j0ND003439; Mon, 12 Feb 2018 03:45:30 -0600 From: Tomi Valkeinen To: , Laurent Pinchart , Peter Ujfalusi , Jyri Sarha , Benoit Parrot Subject: [PATCH 16/24] drm/omap: set WB channel-in in wb_setup() Date: Mon, 12 Feb 2018 11:44:46 +0200 Message-ID: <1518428694-18018-17-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> References: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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: Tomi Valkeinen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" We need to know the WB channel-in in wb_setup() to be able to configure WB properly for capture mode. At the moment channel-in is set separately. This patch moves channel-in to wb_setup(). Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/dss/dispc.c | 11 +++-------- drivers/gpu/drm/omapdrm/dss/dss.h | 3 ++- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c index 5e7bdff2821d..7f9186894bd5 100644 --- a/drivers/gpu/drm/omapdrm/dss/dispc.c +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c @@ -1187,13 +1187,6 @@ static enum omap_channel dispc_ovl_get_channel_out(enum omap_plane_id plane) } } -void dispc_wb_set_channel_in(enum dss_writeback_channel channel) -{ - enum omap_plane_id plane = OMAP_DSS_WB; - - REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), channel, 18, 16); -} - static void dispc_ovl_set_burst_size(enum omap_plane_id plane, enum omap_burst_size burst_size) { @@ -2659,7 +2652,8 @@ static int dispc_ovl_setup(enum omap_plane_id plane, } int dispc_wb_setup(const struct omap_dss_writeback_info *wi, - bool mem_to_mem, const struct videomode *vm) + bool mem_to_mem, const struct videomode *vm, + enum dss_writeback_channel channel_in) { int r; u32 l; @@ -2704,6 +2698,7 @@ int dispc_wb_setup(const struct omap_dss_writeback_info *wi, /* setup extra DISPC_WB_ATTRIBUTES */ l = dispc_read_reg(DISPC_OVL_ATTRIBUTES(plane)); l = FLD_MOD(l, truncation, 10, 10); /* TRUNCATIONENABLE */ + l = FLD_MOD(l, channel_in, 18, 16); /* CHANNELIN */ l = FLD_MOD(l, mem_to_mem, 19, 19); /* WRITEBACKMODE */ if (mem_to_mem) l = FLD_MOD(l, 1, 26, 24); /* CAPTUREMODE */ diff --git a/drivers/gpu/drm/omapdrm/dss/dss.h b/drivers/gpu/drm/omapdrm/dss/dss.h index 7f3fa5330408..19143ab5393c 100644 --- a/drivers/gpu/drm/omapdrm/dss/dss.h +++ b/drivers/gpu/drm/omapdrm/dss/dss.h @@ -385,7 +385,8 @@ bool dispc_wb_go_busy(void); void dispc_wb_go(void); void dispc_wb_set_channel_in(enum dss_writeback_channel channel); int dispc_wb_setup(const struct omap_dss_writeback_info *wi, - bool mem_to_mem, const struct videomode *vm); + bool mem_to_mem, const struct videomode *vm, + enum dss_writeback_channel channel_in); #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS static inline void dss_collect_irq_stats(u32 irqstatus, unsigned int *irq_arr) From patchwork Mon Feb 12 09:44:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 127977 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3041361ljc; Mon, 12 Feb 2018 01:47:26 -0800 (PST) X-Google-Smtp-Source: AH8x227Ot71RW5Kf8Hp1FIUKWvOB9M6O3Haa2J9uokjFUD1DZ7PeGpoPbAATfo7+0yng+Lh0gViT X-Received: by 10.98.55.66 with SMTP id e63mr11325820pfa.102.1518428846257; Mon, 12 Feb 2018 01:47:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518428846; cv=none; d=google.com; s=arc-20160816; b=ADTRaC/L5K2vvVpagS5/jIFxGof8fAzyf9YLKKkPwuhiXADeQ1KDlqBJtU+zfo7/+d SE5o/AfcY2uxpESPZYnIuXUB6o/ENYE2eNxyP7te1s61nO+AdwYznlW+jVzlKy/jcQqt XluTpszjJIKsl9cLokQbBcuAxnUr/Rz0wD11+CzZFzZnqpgBw6xJY7QhKYqW14Fh3cxm qKIvuAcQ3jWZOCMMdiAPltGIc5trJj1DYIFgLCSvmfoQPFsEOhnnykPCXBc6tMhn/H+P 2KypwUHgnXJQmp7zdF3sGVAmZ6oUnh2L4AZlDorHrQk0U0o7zwkbwKMtaSAtOdon/8AV MDwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=qcl8YJHruGHJKG7wLZr3GlcfWnXfJROaDRNtnei/jHs=; b=dLA5ri5k0gnhbEaKNRxbzUIDvkFFmn4B77N/IZ2vDyEfdlTh86pnBOR2oaa9FQ1K4y IDtEijmtM80T4Q6Wy+FLXFf/83rUhZniK1dl3jBZUxv5NUd8W+Yru1IJoqtnMijSevrU b+JCmxjDhUQ+z4FXb3P/mCxfhXb7L18wdK3C/LbYSddasCoMv/9Zk+J+csgZ8ZdRJyYc tADwtqSYRY2T4SyzoGsr2ZrxrFz2KzdOfO39PBclcbqnkfON6OK4sHKNkxsdoYBgzMTq GbmSQtBx4PxtBq6gJOFa/hWwgRYjrHq+P5FNiwEMkAvCxzT+AfezYHDrO5MlqW0FLCE6 pzkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=yjEY/5Wp; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id v85si3828509pfk.237.2018.02.12.01.47.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 01:47:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=yjEY/5Wp; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 283796E14B; Mon, 12 Feb 2018 09:45:48 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelnx194.ext.ti.com (lelnx194.ext.ti.com [198.47.27.80]) by gabe.freedesktop.org (Postfix) with ESMTPS id 186356E0EA for ; Mon, 12 Feb 2018 09:45:40 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1C9jbqI007876; Mon, 12 Feb 2018 03:45:37 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1518428737; bh=PB0h0cUg1oqmi5P5GC2aEbibXnXUpoIHnk6aGgkx7/c=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=yjEY/5Wpz8vcq5+pjnWs7mNkfqxhXtK7SHg7212CMtCV8aBwHR/kwJM5DqujwAGKB g8yGJx1sRuaDTt4bzfJyzFSrzr4ogV80FicKzWsz9p5BIpUYiM+hZR9rFOzEsiMRz6 C4HpmJrBxbOg1L/FlKgZXus6Cwcwl3RlA/IWW0aQ= Received: from DLEE103.ent.ti.com (dlee103.ent.ti.com [157.170.170.33]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9jbNt019460; Mon, 12 Feb 2018 03:45:37 -0600 Received: from DLEE112.ent.ti.com (157.170.170.23) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 12 Feb 2018 03:45:34 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 12 Feb 2018 03:45:34 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9j0NE003439; Mon, 12 Feb 2018 03:45:32 -0600 From: Tomi Valkeinen To: , Laurent Pinchart , Peter Ujfalusi , Jyri Sarha , Benoit Parrot Subject: [PATCH 17/24] drm/omap: fix WBDELAYCOUNT for HDMI Date: Mon, 12 Feb 2018 11:44:47 +0200 Message-ID: <1518428694-18018-18-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> References: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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: Tomi Valkeinen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" For HDMI, WBDELAYCOUNT starts counting at the start of vsync, not at the start of vfp. This patch adjusts the wbdelay for HDMI accordingly. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/dss/dispc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c index 7f9186894bd5..669ee9df224b 100644 --- a/drivers/gpu/drm/omapdrm/dss/dispc.c +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c @@ -2712,8 +2712,12 @@ int dispc_wb_setup(const struct omap_dss_writeback_info *wi, } else { int wbdelay; - wbdelay = min(vm->vfront_porch + - vm->vsync_len + vm->vback_porch, (u32)255); + if (channel_in == DSS_WB_TV_MGR) + wbdelay = min(vm->vsync_len + vm->vback_porch, + (u32)255); + else + wbdelay = min(vm->vfront_porch + + vm->vsync_len + vm->vback_porch, (u32)255); /* WBDELAYCOUNT */ REG_FLD_MOD(DISPC_OVL_ATTRIBUTES2(plane), wbdelay, 7, 0); From patchwork Mon Feb 12 09:44:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 127975 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3041140ljc; Mon, 12 Feb 2018 01:47:09 -0800 (PST) X-Google-Smtp-Source: AH8x225QAYrycY1OegJAnNr/lMjOlN1NpYao45UghIbkqn3riY+BpklNPkFj7dZiYbLYi02BI2QU X-Received: by 10.99.179.77 with SMTP id x13mr8923730pgt.135.1518428829356; Mon, 12 Feb 2018 01:47:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518428829; cv=none; d=google.com; s=arc-20160816; b=LqqB5rklj0sANgVPS1dqPoEQ5KgJFDhsYmMWeO1Om7E0DpoqMpZJd32qaxN8SMOJj2 junmF6/yVy2u6GevrCxXKUc1nlJThvrkuZ8k51Z6+Rts2KTpFs1i14kQmbnRAgt5tPX+ ZRsGmcWob0+mIHmPXjcnjAijmSDaRmgLb2JRtXz/SZ6Kbr/kgUN/NtVVbivMEUaVlIrP +ERBZ62cn9gkOMQeOpgWzlDirnPeN3EsLAMLi/KorItqmN0mIlWguer01ylN0Dw6L+9v O7ZxlMQyz0kN03ohJva/YtlZX5egJ0FcwEQO3tbsVffXWfxKT46Yl16hx3o3UsJfXw8B 8BVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=9LXe8R5c4gryOW8K0wHJEKiGqGJu+pGG3LG3cFs/d2o=; b=jHjVXgadys9mEb/JAmi50NDSMJ4aC7BZsRxzFcU6qLj14yStFOAkexhVaPco2c39tT KGRtVaSXZo0WDsZFnHQ5Ke9lyZzAQQyqfWKVETIi9uZR7q1tRMJwx0psNAzFFhfOlkYG NeEJKcschPVIB4vBLySRv/vRlqNDe2gSfqzlPcgbEASkc3Dk2Xrz0oJIZ0dE/rYCKhEA YxSZePDza78aYDROx5/natE8oM1kaFCaxS4KXXDXJRiSXv9LE43YIpZdD/CQVNsqYWJA XyD5vhLd5Nleu1AyeDrdmDfNKVk1cGbGbK6K1mJpng4d4jzPnE5rtFB4wELppbgmoZjf oBMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=v7n3vDI7; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id u8-v6si396794plh.41.2018.02.12.01.47.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 01:47:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=v7n3vDI7; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 182566E0FD; Mon, 12 Feb 2018 09:45:41 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllnx210.ext.ti.com (fllnx210.ext.ti.com [198.47.19.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id C461C6E0EA for ; Mon, 12 Feb 2018 09:45:38 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1C9jaQl009897; Mon, 12 Feb 2018 03:45:36 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1518428736; bh=Oh23RZxPNbD2CTTOQLVNISN1kTvTMYiw6XvLZ3RF464=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=v7n3vDI7YySOKgFRkfDy9UJePNJl+MRB/WHhujhaQBBJ1pKq+kmMq5Pq7gqF3JBud OZgu5WHIR1hRl18TDcXEoGcdKXHEe3eqkHFwgIJyAhAx/ait7sADSG1Wqo2Si4Of8z ys/86BbxjQdkA3ARcY8UBoB64jItr42a/lCSw4Sw= Received: from DLEE100.ent.ti.com (dlee100.ent.ti.com [157.170.170.30]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9ja9C020412; Mon, 12 Feb 2018 03:45:36 -0600 Received: from DLEE108.ent.ti.com (157.170.170.38) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 12 Feb 2018 03:45:36 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 12 Feb 2018 03:45:36 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9j0NF003439; Mon, 12 Feb 2018 03:45:34 -0600 From: Tomi Valkeinen To: , Laurent Pinchart , Peter Ujfalusi , Jyri Sarha , Benoit Parrot Subject: [PATCH 18/24] drm/omap: fix WBDELAYCOUNT with interlace Date: Mon, 12 Feb 2018 11:44:48 +0200 Message-ID: <1518428694-18018-19-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> References: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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: Tomi Valkeinen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Vertical blanking needs to be halved on interlace modes. WBDELAYCOUNT was calculated without such halving, resulting in WBUNCOMPLETE errors. Signed-off-by: Tomi Valkeinen Acked-by: Benoit Parrot --- drivers/gpu/drm/omapdrm/dss/dispc.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c index 669ee9df224b..99bbc97d0de4 100644 --- a/drivers/gpu/drm/omapdrm/dss/dispc.c +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c @@ -2710,14 +2710,18 @@ int dispc_wb_setup(const struct omap_dss_writeback_info *wi, /* WBDELAYCOUNT */ REG_FLD_MOD(DISPC_OVL_ATTRIBUTES2(plane), 0, 7, 0); } else { - int wbdelay; + u32 wbdelay; if (channel_in == DSS_WB_TV_MGR) - wbdelay = min(vm->vsync_len + vm->vback_porch, - (u32)255); + wbdelay = vm->vsync_len + vm->vback_porch; else - wbdelay = min(vm->vfront_porch + - vm->vsync_len + vm->vback_porch, (u32)255); + wbdelay = vm->vfront_porch + vm->vsync_len + + vm->vback_porch; + + if (vm->flags & DISPLAY_FLAGS_INTERLACED) + wbdelay /= 2; + + wbdelay = min(wbdelay, 255u); /* WBDELAYCOUNT */ REG_FLD_MOD(DISPC_OVL_ATTRIBUTES2(plane), wbdelay, 7, 0); From patchwork Mon Feb 12 09:44:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 127969 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3040727ljc; Mon, 12 Feb 2018 01:46:33 -0800 (PST) X-Google-Smtp-Source: AH8x226v6/HsXBXCSQaRN5RH7dUhUT80bsMC9rwc0MAcMc6p6revoVcm0g6br5tPmA3uMbEpSAr6 X-Received: by 10.98.212.6 with SMTP id a6mr10654282pfh.104.1518428793252; Mon, 12 Feb 2018 01:46:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518428793; cv=none; d=google.com; s=arc-20160816; b=EudWUrcF7ARxRn5z8KfaSu4mdBIoYAR9JxXHoAYEEqPMvdZ6sGFkPfneRdizEA4cmw oBH8/T2AncO8Vvv14XXOSH4sSwsnw1de5zn1CYP7tkVVdKU1n0bfHLw2AyYNis86RQnO vhUraLesdMbqmtl2MkkQ3x9lyWjOPgDq7nZoBcPzDjWI1+Dn4VKvxORa3fMBSX/SpqLD 24Eo1jtzWP3OmLOCaiB/Ayn7k/4Fodh8TCPu0SremRQGusMD5RoEnAs6XrdRAZZZMFMC tLG0MyNgZ8tacEvPS9MChhsDzrkauYM6Hazmv2cl3QtCtGsS4K1PKU5zVR8chQufhhPe ASSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=+XGTb34rEBJaNnvWTf0qHrjA1Ne1SljsXmG1sE5Qpks=; b=uAGiEGsmLK8GwrxWXnX4UrLaaQaIOICMkzjJKW6ftIQX0tblIqAhkrDPZfVw/8loaz W8z2E4Gj+Q+hMFZl5Q5l13OCuNLCKrTrxL4AzH2EcfFxck5jDgoW17tFqBxZFgdyI04A mMeXzdHFpL0aoT7bw1bgpZGcirZs69Hl3SCLEK252JYbfsrRPi8sq46EkxrciN0bz/1i DD1z9yfwKg7kjIRscmopcikGZpIs7Kf5JbtrTUqgAmG1XNI/Kbb6bHxjH4RahLgl7aDT OtrSQFE7SHIlbXHuPdoGmlFx/NrCT3Lmx+aoUlcuDuCPhZXn6jxzZG5io87Y4igavfsl mo6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=S7UY7Nwm; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id 37-v6si1661670ple.491.2018.02.12.01.46.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 01:46:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=S7UY7Nwm; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DBF986E0EA; Mon, 12 Feb 2018 09:45:40 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllnx210.ext.ti.com (fllnx210.ext.ti.com [198.47.19.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 655AB6E0EA for ; Mon, 12 Feb 2018 09:45:40 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1C9jcgT009905; Mon, 12 Feb 2018 03:45:38 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1518428738; bh=Usxvbx2OEa6rC1aBG9Uc3mC044d9PenrqqXmwzG1NB0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=S7UY7Nwm6ERLudegVuL0Yz2kgsMFLli5KzrFqUpjDzD0rRd6uGjs19uUG51cRFUaN aphQZcNiQ9MAIKmOWTpOe8c3cn0k1ic9BBGmXM1aZi8npBfI/M5bcudgKqBezKMSix mI2TuhsyolC4PV0H5cLRg8NSsnRBmyifntfbKcb8= Received: from DFLE112.ent.ti.com (dfle112.ent.ti.com [10.64.6.33]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9jcnN019501; Mon, 12 Feb 2018 03:45:38 -0600 Received: from DFLE109.ent.ti.com (10.64.6.30) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 12 Feb 2018 03:45:37 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 12 Feb 2018 03:45:37 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9j0NG003439; Mon, 12 Feb 2018 03:45:36 -0600 From: Tomi Valkeinen To: , Laurent Pinchart , Peter Ujfalusi , Jyri Sarha , Benoit Parrot Subject: [PATCH 19/24] drm/omap: fix WB height with interlace Date: Mon, 12 Feb 2018 11:44:49 +0200 Message-ID: <1518428694-18018-20-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> References: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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: Tomi Valkeinen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" When using WB capture from interlaced source, we need to halve the picture heights correctly. Unfortunately the current dispc_ovl_setup_common() doesn't deal with interlace very neatly, so the end result is a bit messy. Signed-off-by: Tomi Valkeinen Acked-by: Benoit Parrot --- drivers/gpu/drm/omapdrm/dss/dispc.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c index 99bbc97d0de4..3d804187df13 100644 --- a/drivers/gpu/drm/omapdrm/dss/dispc.c +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c @@ -2496,18 +2496,19 @@ static int dispc_ovl_setup_common(enum omap_plane_id plane, out_width = out_width == 0 ? width : out_width; out_height = out_height == 0 ? height : out_height; - if (ilace && height == out_height) - fieldmode = true; - - if (ilace) { - if (fieldmode) - in_height /= 2; - pos_y /= 2; - out_height /= 2; - - DSSDBG("adjusting for ilace: height %d, pos_y %d, " - "out_height %d\n", in_height, pos_y, - out_height); + if (plane != OMAP_DSS_WB) { + if (ilace && height == out_height) + fieldmode = true; + + if (ilace) { + if (fieldmode) + in_height /= 2; + pos_y /= 2; + out_height /= 2; + + DSSDBG("adjusting for ilace: height %d, pos_y %d, out_height %d\n", + in_height, pos_y, out_height); + } } if (!dispc_ovl_color_mode_supported(plane, fourcc)) @@ -2667,6 +2668,9 @@ int dispc_wb_setup(const struct omap_dss_writeback_info *wi, enum omap_overlay_caps caps = OMAP_DSS_OVL_CAP_SCALE | OMAP_DSS_OVL_CAP_PRE_MULT_ALPHA; + if (vm->flags & DISPLAY_FLAGS_INTERLACED) + in_height /= 2; + DSSDBG("dispc_wb_setup, pa %x, pa_uv %x, %d,%d -> %dx%d, cmode %x, " "rot %d\n", wi->paddr, wi->p_uv_addr, in_width, in_height, wi->width, wi->height, wi->fourcc, wi->rotation); From patchwork Mon Feb 12 09:44:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 127971 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3040859ljc; Mon, 12 Feb 2018 01:46:45 -0800 (PST) X-Google-Smtp-Source: AH8x22727VFvc+DwZgvS9bH5AtLIMnAfImhuGKNQx5GicHPpbbwAZXO80gWcS5n/hx7C0zGLFbnw X-Received: by 10.98.189.8 with SMTP id a8mr11101046pff.125.1518428805328; Mon, 12 Feb 2018 01:46:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518428805; cv=none; d=google.com; s=arc-20160816; b=HkWJ9H01Hp6AfwNs99+j9sFXuTmoP+HEzdtvL9VnhOORANmdpvr0nBExtDVgi8ec6P DffDmg5w5mBWHmkjva56b1lzJnfxVoE01m+1tHNLIjRCOtZCUrJBs9FmuPtP/gJ00pbf HYhkyII8Ln30qmzQpo4nwRaGr0UJCQOt8VcpDJOJFt9hzTQPEQkkc+y38uAc96rEtCOD CcBiy04ULWHkgconKtWbfGYsFl79hCKTCK+pF4GFxd+e6Rrr9G+o+PijRwCKGqi+JQUQ zKmJ/mLp9NadEmrlageySw1m932nOUMVFXixN0tLHLP5WL5XpWgCYI4ttv/W3y6MUrj8 goIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=ljzK5k/vZkortrs/WFqPQoU6xp5Q5OmfEq4rrL4udpo=; b=Neyz13Akf9pnHz3KPlW0AHhhVbO32X/7P/GAw57YXa9JBxT+qP5J9SdacO5XBXHaMF +PTUHqIynKBASe6ZlgZwRmUr00ZDPvk8GVSMAN160qQtPgvDJgxJ+3iKGA3JMnYSs0Oo j7ha8ApIPPKSykINGcxXGiVA2Lepz9MH2U/S7aFgib8yFrTAb2I8jWOy+2vBai+qN9yO H4XCchMlJtU6T+btxNfH5h+hPZVCoSFp+zuTCfdTCZbQrFeKELFFyyQI/IwRdXMOLR/m MDBoblcNH78hn5Bfhw0JuaeVeBFuL4Lco7AAz6MzDIGdm62lqECEDglKxwsNS/B3aGcD NhYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=LIYznCpJ; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id a5-v6si5562893plp.416.2018.02.12.01.46.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 01:46:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=LIYznCpJ; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 06BF66E1AB; Mon, 12 Feb 2018 09:45:45 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelnx193.ext.ti.com (lelnx193.ext.ti.com [198.47.27.77]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7395B6E1AB for ; Mon, 12 Feb 2018 09:45:42 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1C9jeos016067; Mon, 12 Feb 2018 03:45:40 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1518428740; bh=JpCtcF637omENBV7BGnu4+UenB6FtPDkJ118RWeO+8w=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=LIYznCpJLdzimdkmgy/UQ9raKI+2VH9O9h2zkNZJ+FW/gYH8BVXnXWaRAgm/nh5Uf warK8QQ4dXQUtjed78NQsF9pP8nRrPwKXPzyycaCFZK1iXvUZpq4RcBVyoHeNA+i07 KoJg2Xq4buiMBcXUzZEBtVlDtLB+CD9JlRUc+1QI= Received: from DFLE103.ent.ti.com (dfle103.ent.ti.com [10.64.6.24]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9jeLo019568; Mon, 12 Feb 2018 03:45:40 -0600 Received: from DFLE107.ent.ti.com (10.64.6.28) by DFLE103.ent.ti.com (10.64.6.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 12 Feb 2018 03:45:39 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE107.ent.ti.com (10.64.6.28) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 12 Feb 2018 03:45:39 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9j0NH003439; Mon, 12 Feb 2018 03:45:38 -0600 From: Tomi Valkeinen To: , Laurent Pinchart , Peter Ujfalusi , Jyri Sarha , Benoit Parrot Subject: [PATCH 20/24] drm/omap: fix scaling limits for WB Date: Mon, 12 Feb 2018 11:44:50 +0200 Message-ID: <1518428694-18018-21-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> References: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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: Tomi Valkeinen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" WB has additional scaling limits when the output color format is one of the YUV formats. These limits are not handled at the moment, causing bad scaling and/or NULL dereference crash. This patchs adds the check so that dispc returns an error for bad scaling request. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/dss/dispc.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c index 3d804187df13..2d19852553f5 100644 --- a/drivers/gpu/drm/omapdrm/dss/dispc.c +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c @@ -2381,7 +2381,8 @@ static int dispc_ovl_calc_scaling_44xx(unsigned long pclk, unsigned long lclk, #define DIV_FRAC(dividend, divisor) \ ((dividend) * 100 / (divisor) - ((dividend) / (divisor) * 100)) -static int dispc_ovl_calc_scaling(unsigned long pclk, unsigned long lclk, +static int dispc_ovl_calc_scaling(enum omap_plane_id plane, + unsigned long pclk, unsigned long lclk, enum omap_overlay_caps caps, const struct videomode *vm, u16 width, u16 height, u16 out_width, u16 out_height, @@ -2389,7 +2390,8 @@ static int dispc_ovl_calc_scaling(unsigned long pclk, unsigned long lclk, int *x_predecim, int *y_predecim, u16 pos_x, enum omap_dss_rotation_type rotation_type, bool mem_to_mem) { - const int maxdownscale = dispc.feat->max_downscale; + int maxhdownscale = dispc.feat->max_downscale; + int maxvdownscale = dispc.feat->max_downscale; const int max_decim_limit = 16; unsigned long core_clk = 0; int decim_x, decim_y, ret; @@ -2397,6 +2399,20 @@ static int dispc_ovl_calc_scaling(unsigned long pclk, unsigned long lclk, if (width == out_width && height == out_height) return 0; + if (plane == OMAP_DSS_WB) { + switch (fourcc) { + case DRM_FORMAT_NV12: + maxhdownscale = maxvdownscale = 2; + break; + case DRM_FORMAT_YUYV: + case DRM_FORMAT_UYVY: + maxhdownscale = 2; + maxvdownscale = 4; + break; + default: + break; + } + } if (!mem_to_mem && (pclk == 0 || vm->pixelclock == 0)) { DSSERR("cannot calculate scaling settings: pclk is zero\n"); return -EINVAL; @@ -2414,8 +2430,8 @@ static int dispc_ovl_calc_scaling(unsigned long pclk, unsigned long lclk, 2 : max_decim_limit; } - decim_x = DIV_ROUND_UP(DIV_ROUND_UP(width, out_width), maxdownscale); - decim_y = DIV_ROUND_UP(DIV_ROUND_UP(height, out_height), maxdownscale); + decim_x = DIV_ROUND_UP(DIV_ROUND_UP(width, out_width), maxhdownscale); + decim_y = DIV_ROUND_UP(DIV_ROUND_UP(height, out_height), maxvdownscale); if (decim_x > *x_predecim || out_width > width * 8) return -EINVAL; @@ -2514,7 +2530,7 @@ static int dispc_ovl_setup_common(enum omap_plane_id plane, if (!dispc_ovl_color_mode_supported(plane, fourcc)) return -EINVAL; - r = dispc_ovl_calc_scaling(pclk, lclk, caps, vm, in_width, + r = dispc_ovl_calc_scaling(plane, pclk, lclk, caps, vm, in_width, in_height, out_width, out_height, fourcc, &five_taps, &x_predecim, &y_predecim, pos_x, rotation_type, mem_to_mem); From patchwork Mon Feb 12 09:44:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 127976 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3041297ljc; Mon, 12 Feb 2018 01:47:20 -0800 (PST) X-Google-Smtp-Source: AH8x224xZPm5pNwnDaltQk29+sRe9LPw08oFI6Qo3slHdzKKdbBN5UqcTaFfTpWTNQaVX7EnjgZk X-Received: by 10.98.220.6 with SMTP id t6mr11221808pfg.20.1518428840720; Mon, 12 Feb 2018 01:47:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518428840; cv=none; d=google.com; s=arc-20160816; b=UhuACXIYqRaFy3D+5BC9+gTWIJlXJGdMutXr2byykVMpJEuDS6UYQxS5YDkTPt0pFm VEEq60XSq87GXgBpEs7iYFe37QNlgGVpdavNM8qvXQhR87yY9VdG47SxGCvi0Q4uDzCJ enyTSgzJdeHi5lrz/+i/8SsSBfU8093S1Zig0T2NXKX4No6F+jYN6FTDiyoGqewC7nFE t2HqyWVzoQwcoUiIEri5fzqR/ZnQHriNbZY8CULHqM1zPWUzxcBlznINY72QarTLsHPb aLn72F38xG9XFMXoNJHAhrKOJQd4W13pYAbej2X1AtjvCd1ztPUpuHYtDWdvf+PGf23E QjMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=16Y+PCDyKPTlvTBGQO9F+CYqlRzH9nMhdM3MKV3nmhY=; b=l0quI7vckIi+NNlAgrgHADcrCHgmxh/W+j3Rm+5d+VpZ9JuF9XUeoTS32i1SxxpeQp zoP+/TJwWDVCNDWb1c3uQrd0tiVvUe0sScL8zUpexxpyyvLzmST8FBMP0Daaw571LXEM 01MdU2es2np4fHXkVYXIDhrTakePoEKMvADv06PQD9ndkyua4LcGT6/Sa9/7oeJCyPQV 1ZmOR392cPLfIRoBAj0XSnHk66M9eWxdo4bO0ptLu4yIH32wBElGL/YOz1/Pt87LzEY1 X2QqZELabD/71QfGSdbhe8GZ8VmafeO4VNSMUz5r09qPC1VNZkcy6t3yahXPjbxltU6N hPyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=lzcnAG8W; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id h82si4293943pfd.126.2018.02.12.01.47.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 01:47:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=lzcnAG8W; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5B80A6E1C2; Mon, 12 Feb 2018 09:45:46 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelnx194.ext.ti.com (lelnx194.ext.ti.com [198.47.27.80]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4B1046E1AB for ; Mon, 12 Feb 2018 09:45:44 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1C9jgfa007884; Mon, 12 Feb 2018 03:45:42 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1518428742; bh=UBIr1bc4S8ecokiPZImmM8qRTG0wOjc1NC1SDbnkn80=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=lzcnAG8W5YCnAUwx8geuWFW1BmvNySALXMnjkMP5UMhBoTuRg3EYjFuhlHPKxxUNS ojfedERXNx1nyE8nKEE3XeKO2Uev5aFymJ0xVO9FqObOGkYrVGtTnXn+GjYtcS7oFv rq0TYiza3ylP+DRcl/axeaPZ1sEuUf3RvsyaeBJU= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9jg3J020618; Mon, 12 Feb 2018 03:45:42 -0600 Received: from DLEE113.ent.ti.com (157.170.170.24) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 12 Feb 2018 03:45:41 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 12 Feb 2018 03:45:41 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9j0NI003439; Mon, 12 Feb 2018 03:45:40 -0600 From: Tomi Valkeinen To: , Laurent Pinchart , Peter Ujfalusi , Jyri Sarha , Benoit Parrot Subject: [PATCH 21/24] drm/omap: add writeback funcs to dispc_ops Date: Mon, 12 Feb 2018 11:44:51 +0200 Message-ID: <1518428694-18018-22-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> References: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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: Tomi Valkeinen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add writeback specific dispc functions to dispc_ops so that omapdrm can use them. Also move 'enum dss_writeback_channel' to the public omapdss.h for omapdrm. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/dss/dispc.c | 19 +++++++++++++++---- drivers/gpu/drm/omapdrm/dss/dss.h | 19 ------------------- drivers/gpu/drm/omapdrm/dss/omapdss.h | 19 +++++++++++++++++++ 3 files changed, 34 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c index 2d19852553f5..ff09e2be470f 100644 --- a/drivers/gpu/drm/omapdrm/dss/dispc.c +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c @@ -698,7 +698,7 @@ static u32 dispc_mgr_get_sync_lost_irq(enum omap_channel channel) return mgr_desc[channel].sync_lost_irq; } -u32 dispc_wb_get_framedone_irq(void) +static u32 dispc_wb_get_framedone_irq(void) { return DISPC_IRQ_FRAMEDONEWB; } @@ -730,12 +730,12 @@ static void dispc_mgr_go(enum omap_channel channel) mgr_fld_write(channel, DISPC_MGR_FLD_GO, 1); } -bool dispc_wb_go_busy(void) +static bool dispc_wb_go_busy(void) { return REG_GET(DISPC_CONTROL2, 6, 6) == 1; } -void dispc_wb_go(void) +static void dispc_wb_go(void) { enum omap_plane_id plane = OMAP_DSS_WB; bool enable, go; @@ -2668,7 +2668,7 @@ static int dispc_ovl_setup(enum omap_plane_id plane, return r; } -int dispc_wb_setup(const struct omap_dss_writeback_info *wi, +static int dispc_wb_setup(const struct omap_dss_writeback_info *wi, bool mem_to_mem, const struct videomode *vm, enum dss_writeback_channel channel_in) { @@ -2750,6 +2750,11 @@ int dispc_wb_setup(const struct omap_dss_writeback_info *wi, return 0; } +static bool dispc_has_writeback(void) +{ + return dispc.feat->has_writeback; +} + static int dispc_ovl_enable(enum omap_plane_id plane, bool enable) { DSSDBG("dispc_enable_plane %d, %d\n", plane, enable); @@ -4553,6 +4558,12 @@ static const struct dispc_ops dispc_ops = { .ovl_enable = dispc_ovl_enable, .ovl_setup = dispc_ovl_setup, .ovl_get_color_modes = dispc_ovl_get_color_modes, + + .wb_get_framedone_irq = dispc_wb_get_framedone_irq, + .wb_setup = dispc_wb_setup, + .has_writeback = dispc_has_writeback, + .wb_go_busy = dispc_wb_go_busy, + .wb_go = dispc_wb_go, }; /* DISPC HW IP initialisation */ diff --git a/drivers/gpu/drm/omapdrm/dss/dss.h b/drivers/gpu/drm/omapdrm/dss/dss.h index 19143ab5393c..e2e679544e41 100644 --- a/drivers/gpu/drm/omapdrm/dss/dss.h +++ b/drivers/gpu/drm/omapdrm/dss/dss.h @@ -97,17 +97,6 @@ enum dss_dsi_content_type { DSS_DSI_CONTENT_GENERIC, }; -enum dss_writeback_channel { - DSS_WB_LCD1_MGR = 0, - DSS_WB_LCD2_MGR = 1, - DSS_WB_TV_MGR = 2, - DSS_WB_OVL0 = 3, - DSS_WB_OVL1 = 4, - DSS_WB_OVL2 = 5, - DSS_WB_OVL3 = 6, - DSS_WB_LCD3_MGR = 7, -}; - enum dss_clk_source { DSS_CLK_SRC_FCK = 0, @@ -380,14 +369,6 @@ int dispc_mgr_get_clock_div(enum omap_channel channel, struct dispc_clock_info *cinfo); void dispc_set_tv_pclk(unsigned long pclk); -u32 dispc_wb_get_framedone_irq(void); -bool dispc_wb_go_busy(void); -void dispc_wb_go(void); -void dispc_wb_set_channel_in(enum dss_writeback_channel channel); -int dispc_wb_setup(const struct omap_dss_writeback_info *wi, - bool mem_to_mem, const struct videomode *vm, - enum dss_writeback_channel channel_in); - #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS static inline void dss_collect_irq_stats(u32 irqstatus, unsigned int *irq_arr) { diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h index 51aefd80bcd4..2139735878c8 100644 --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h @@ -618,6 +618,17 @@ void omapdss_set_is_initialized(bool set); struct device_node *dss_of_port_get_parent_device(struct device_node *port); u32 dss_of_port_get_port_number(struct device_node *port); +enum dss_writeback_channel { + DSS_WB_LCD1_MGR = 0, + DSS_WB_LCD2_MGR = 1, + DSS_WB_TV_MGR = 2, + DSS_WB_OVL0 = 3, + DSS_WB_OVL1 = 4, + DSS_WB_OVL2 = 5, + DSS_WB_OVL3 = 6, + DSS_WB_LCD3_MGR = 7, +}; + struct dss_mgr_ops { int (*connect)(enum omap_channel channel, struct omap_dss_device *dst); @@ -700,6 +711,14 @@ struct dispc_ops { enum omap_channel channel); const u32 *(*ovl_get_color_modes)(enum omap_plane_id plane); + + u32 (*wb_get_framedone_irq)(void); + int (*wb_setup)(const struct omap_dss_writeback_info *wi, + bool mem_to_mem, const struct videomode *vm, + enum dss_writeback_channel channel_in); + bool (*has_writeback)(void); + bool (*wb_go_busy)(void); + void (*wb_go)(void); }; void dispc_set_ops(const struct dispc_ops *o); From patchwork Mon Feb 12 09:44:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 127973 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3041048ljc; Mon, 12 Feb 2018 01:47:01 -0800 (PST) X-Google-Smtp-Source: AH8x227NaS3gCowEpBv+MM8Xp0B5HIEqhBPJsiIusSQ9O0pFEBPPMm+3/QLXeOIk+S42fPuUaMKv X-Received: by 2002:a17:902:5481:: with SMTP id e1-v6mr10411952pli.410.1518428821441; Mon, 12 Feb 2018 01:47:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518428821; cv=none; d=google.com; s=arc-20160816; b=AzrZ0WGMGW1zf8a/8dX39Tybz0x7pST0Hm60R9fTlfNjRv0hmanAd0tKBMint8tAZp pD6y+FM8Mwm4suyH4e9AWw4IAJ7YWFSl8LAMTcaYSiOT05kRoJeidyC1f4rJ+59J1gGi gq1ZsIXQe3o1o3mLemq/P/UEcH4DA+cTVBNtqbafiMorweVh7JZWazgvMtnduKG7ALXY BKNralmD/ZIpJTHYqqwb8gF/J5nJjWl/d7UEp9HWulxNJK3oQwImnZxxIsgl+qQisuwc 46Csixc9BvUuzLTpicZMMGqLs73ElSZ4DRWQbMJmm8v8Fh1eVS7X7vYjNvYp0nsUl51w Hj0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=rf7eOBDmZY/ojGiNXyzmv8tJRzG2KdQcI1nx2RxfqOA=; b=mZaaZN/rKto63Hmyko+tpOYyjJKCfdBVnZs6+JmRjHbgc0w9bbShEGyMke1SEhAALE Pvjp+FAjup1dCzo8tWN9GOJ469LdnQUjtTwSJDpEK0fIx0uqSB0gL/2Zl4X1zCCBw9Ae JIkKs8n4P/dP6r00tw3xXVJ7jB6tYF4J7VAanvltZCyFG7C1vAikvZ04X8po6OtJLYcE w9r25juwcgbrEOnMPCVco9ZEGAkxiBXhzp4udalK5bM7eSKEi2dqCY8zMM8gkAwxcdFn JM3tBONX157mnuxOAEsIbSizk7SnG99Bq9FiLaCP6CMSt/tZ4/HknhTkEOaMRXWqUOSj gv9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=TscygPv3; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id q187si188500pga.547.2018.02.12.01.47.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 01:47:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=TscygPv3; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 06EB96E184; Mon, 12 Feb 2018 09:45:50 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllnx209.ext.ti.com (fllnx209.ext.ti.com [198.47.19.16]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0B4766E1C2 for ; Mon, 12 Feb 2018 09:45:45 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1C9jhZn019018; Mon, 12 Feb 2018 03:45:43 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1518428743; bh=wD9T8+qZNh8p5M9Rc+Yw45jtBwymO1pvohgnl8iYEbQ=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=TscygPv3fT4BBfF6W0OQoc1KN0qM52ylWETA5lcUvu0iig4RjX9VABLJGsOSPDn2E 8T6vgHszxgQN0hSJSlCIRdQiCBMH6hqgX/DMVwiyeK/c2/XDJNm7a0qSpaKqb0evm9 ydCznv6gQrLc14ie76/sA5rlYRaD+JFapadoBRu4= Received: from DFLE112.ent.ti.com (dfle112.ent.ti.com [10.64.6.33]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9jhlE020695; Mon, 12 Feb 2018 03:45:43 -0600 Received: from DFLE115.ent.ti.com (10.64.6.36) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 12 Feb 2018 03:45:43 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 12 Feb 2018 03:45:43 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9j0NJ003439; Mon, 12 Feb 2018 03:45:41 -0600 From: Tomi Valkeinen To: , Laurent Pinchart , Peter Ujfalusi , Jyri Sarha , Benoit Parrot Subject: [PATCH 22/24] drm/omap: fix maximum sizes Date: Mon, 12 Feb 2018 11:44:52 +0200 Message-ID: <1518428694-18018-23-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> References: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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: Tomi Valkeinen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" We define max width and height in mode_config to 2048. These maximums affect many things, which are independent and depend on platform. We need to do more fine grained checks in the code paths for each component, and so the maximum values in mode_config should just be "big enough" to cover all use cases. Change the maximum width & height to 8192. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/omap_drv.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index 5a27a47b628e..2df125369781 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -412,11 +412,14 @@ static int omap_modeset_init(struct drm_device *dev) dev->mode_config.min_width = 8; dev->mode_config.min_height = 2; - /* note: eventually will need some cpu_is_omapXYZ() type stuff here - * to fill in these limits properly on different OMAP generations.. + /* + * Note: these values are used for multiple independent things: + * connector mode filtering, buffer sizes, crtc sizes... + * Use big enough values here to cover all use cases, and do more + * specific checking in the respective code paths. */ - dev->mode_config.max_width = 2048; - dev->mode_config.max_height = 2048; + dev->mode_config.max_width = 8192; + dev->mode_config.max_height = 8192; dev->mode_config.funcs = &omap_mode_config_funcs; dev->mode_config.helper_private = &omap_mode_config_helper_funcs; From patchwork Mon Feb 12 09:44:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 127978 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3041517ljc; Mon, 12 Feb 2018 01:47:41 -0800 (PST) X-Google-Smtp-Source: AH8x226Ymyz7BphXaNkXYgp5Q+hbAnLDvZwVTdJV2UgkySKXGeTJD1OgUf7thvFq34Ta0P2a6ZnA X-Received: by 2002:a17:902:1683:: with SMTP id h3-v6mr10392026plh.433.1518428861112; Mon, 12 Feb 2018 01:47:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518428861; cv=none; d=google.com; s=arc-20160816; b=N0yBsco6LC7lQ+0C7GsMIRv8zA/TUcb11JnBV/nB8jDKzr1ARUjmir7YqtBlIc9HAo 7V3nZu1pEETVORcTerOgh8guIQj9/CKKIvCTRrW5LppXTCbVD2JRD54/1zYupTS3Vana 0k4sEd+kcRJ8FclcCxss2vwI4Y0CPKVjfF9Fo0Of6jyZjCVSvFWV3vvuXDd4jesw39A6 zucRpdSwI1AzN2IbY8h9xuhgJQqGQVIS9EQHyWalVa1EJHsX4UnKgVwt2/b7sqmSqdbP Xy4wviMEqr1YHX3drhw1haC9TVr3bLoe2vPqTZm28trOzQb3P683b9ATzgR3kWYPOLxS E0+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=+LrWyo6U9Ps/ZUeogQjmm1ZF3O0PMgjxTQzxbl8fKrE=; b=w58KxB9mNSKgnZ1gaqg4lNcfO108H0LTGCeR8IA3dOKWjPbO4A/3M+hP92LMK7rKfq CNBUyCMHSUBdMgIPez1h7uX8H8XVNxSYre6uvOu4totbQCPlwNWDQcqgLUAV6VPy3xeS /fqik/H5GqxP0TXDyxM24uo0IB+tE4wxPux2xSnYgrimzNFleG9Xr2qhkvX3agJAFnIF utsXx+lIdpjmftBAvlobanS9cPK97/ThM24ZMycAKE7g8VLCLsrNBKsRahONV5l4Clpw Mzmn+4lURsNcfgxyo5g1cWhAbMvumymsRucbIIcMJ1ALfwUW66Y7XHnUhHmFKOcDK1h9 FixA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=vAM4Jjtg; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id f7si3814618pfa.168.2018.02.12.01.47.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 01:47:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=vAM4Jjtg; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B13956E1E0; Mon, 12 Feb 2018 09:45:51 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelnx193.ext.ti.com (lelnx193.ext.ti.com [198.47.27.77]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7C5616E14E for ; Mon, 12 Feb 2018 09:45:48 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1C9jjIn016093; Mon, 12 Feb 2018 03:45:46 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1518428746; bh=R5en4G+Oloe/xjEhe04d/dB6NM3/zvrnwju71UP65uc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=vAM4JjtgzQPj9m62Y5Vy5w6PAoQN2hazl0d9PsOCMqE0ONcFShmEXbKH8/5YpeWdq KI1kxxo/AoEtIj4gHYI3sB81/+PMbVj6j5wkpAPE67rjGS7QnyU6f3nhMhwm1P9ZQp moFi6NGBgYBZ1vbZnQsxiC5+kgPqnDn9yxqNZErQ= Received: from DLEE103.ent.ti.com (dlee103.ent.ti.com [157.170.170.33]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9jjMa020777; Mon, 12 Feb 2018 03:45:45 -0600 Received: from DLEE111.ent.ti.com (157.170.170.22) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 12 Feb 2018 03:45:45 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE111.ent.ti.com (157.170.170.22) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 12 Feb 2018 03:45:45 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9j0NK003439; Mon, 12 Feb 2018 03:45:43 -0600 From: Tomi Valkeinen To: , Laurent Pinchart , Peter Ujfalusi , Jyri Sarha , Benoit Parrot Subject: [PATCH 23/24] drm/omap: Allow HDMI audio setup even if we do not have video configured Date: Mon, 12 Feb 2018 11:44:53 +0200 Message-ID: <1518428694-18018-24-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> References: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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: Tomi Valkeinen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Jyri Sarha Allow HDMI audio setup even if we do not have video configured. Audio will get configured at the same time with video if the video is configured soon enough. If it is not the audio DMA will timeout in couple of seconds and audio playback will be aborted. Signed-off-by: Jyri Sarha Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/dss/hdmi4.c | 33 ++++++++++++++------------------- drivers/gpu/drm/omapdrm/dss/hdmi5.c | 37 ++++++++++++++++--------------------- 2 files changed, 30 insertions(+), 40 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c b/drivers/gpu/drm/omapdrm/dss/hdmi4.c index ae6401c569c4..9d5c921cbf7b 100644 --- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c +++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c @@ -598,21 +598,16 @@ static int hdmi_audio_startup(struct device *dev, void (*abort_cb)(struct device *dev)) { struct omap_hdmi *hd = dev_get_drvdata(dev); - int ret = 0; mutex_lock(&hd->lock); - if (!hdmi_mode_has_audio(&hd->cfg) || !hd->display_enabled) { - ret = -EPERM; - goto out; - } + WARN_ON(hd->audio_abort_cb != NULL); hd->audio_abort_cb = abort_cb; -out: mutex_unlock(&hd->lock); - return ret; + return 0; } static int hdmi_audio_shutdown(struct device *dev) @@ -633,12 +628,14 @@ static int hdmi_audio_start(struct device *dev) struct omap_hdmi *hd = dev_get_drvdata(dev); unsigned long flags; - WARN_ON(!hdmi_mode_has_audio(&hd->cfg)); - spin_lock_irqsave(&hd->audio_playing_lock, flags); - if (hd->display_enabled) + if (hd->display_enabled) { + if (!hdmi_mode_has_audio(&hd->cfg)) + DSSERR("%s: Video mode does not support audio\n", + __func__); hdmi_start_audio_stream(hd); + } hd->audio_playing = true; spin_unlock_irqrestore(&hd->audio_playing_lock, flags); @@ -669,17 +666,15 @@ static int hdmi_audio_config(struct device *dev, mutex_lock(&hd->lock); - if (!hdmi_mode_has_audio(&hd->cfg) || !hd->display_enabled) { - ret = -EPERM; - goto out; + if (hd->display_enabled) { + ret = hdmi4_audio_config(&hd->core, &hd->wp, dss_audio, + hd->cfg.vm.pixelclock); + if (ret) + goto out; } - ret = hdmi4_audio_config(&hd->core, &hd->wp, dss_audio, - hd->cfg.vm.pixelclock); - if (!ret) { - hd->audio_configured = true; - hd->audio_config = *dss_audio; - } + hd->audio_configured = true; + hd->audio_config = *dss_audio; out: mutex_unlock(&hd->lock); diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5.c b/drivers/gpu/drm/omapdrm/dss/hdmi5.c index 9571be938d81..33297d282a61 100644 --- a/drivers/gpu/drm/omapdrm/dss/hdmi5.c +++ b/drivers/gpu/drm/omapdrm/dss/hdmi5.c @@ -593,21 +593,16 @@ static int hdmi_audio_startup(struct device *dev, void (*abort_cb)(struct device *dev)) { struct omap_hdmi *hd = dev_get_drvdata(dev); - int ret = 0; mutex_lock(&hd->lock); - if (!hdmi_mode_has_audio(&hd->cfg) || !hd->display_enabled) { - ret = -EPERM; - goto out; - } + WARN_ON(hd->audio_abort_cb != NULL); hd->audio_abort_cb = abort_cb; -out: mutex_unlock(&hd->lock); - return ret; + return 0; } static int hdmi_audio_shutdown(struct device *dev) @@ -628,12 +623,14 @@ static int hdmi_audio_start(struct device *dev) struct omap_hdmi *hd = dev_get_drvdata(dev); unsigned long flags; - WARN_ON(!hdmi_mode_has_audio(&hd->cfg)); - spin_lock_irqsave(&hd->audio_playing_lock, flags); - if (hd->display_enabled) + if (hd->display_enabled) { + if (!hdmi_mode_has_audio(&hd->cfg)) + DSSERR("%s: Video mode does not support audio\n", + __func__); hdmi_start_audio_stream(hd); + } hd->audio_playing = true; spin_unlock_irqrestore(&hd->audio_playing_lock, flags); @@ -645,7 +642,8 @@ static void hdmi_audio_stop(struct device *dev) struct omap_hdmi *hd = dev_get_drvdata(dev); unsigned long flags; - WARN_ON(!hdmi_mode_has_audio(&hd->cfg)); + if (!hdmi_mode_has_audio(&hd->cfg)) + DSSERR("%s: Video mode does not support audio\n", __func__); spin_lock_irqsave(&hd->audio_playing_lock, flags); @@ -664,18 +662,15 @@ static int hdmi_audio_config(struct device *dev, mutex_lock(&hd->lock); - if (!hdmi_mode_has_audio(&hd->cfg) || !hd->display_enabled) { - ret = -EPERM; - goto out; + if (hd->display_enabled) { + ret = hdmi5_audio_config(&hd->core, &hd->wp, dss_audio, + hd->cfg.vm.pixelclock); + if (ret) + goto out; } - ret = hdmi5_audio_config(&hd->core, &hd->wp, dss_audio, - hd->cfg.vm.pixelclock); - - if (!ret) { - hd->audio_configured = true; - hd->audio_config = *dss_audio; - } + hd->audio_configured = true; + hd->audio_config = *dss_audio; out: mutex_unlock(&hd->lock); From patchwork Mon Feb 12 09:44:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 127974 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3041103ljc; Mon, 12 Feb 2018 01:47:06 -0800 (PST) X-Google-Smtp-Source: AH8x226pCTHC5mAPdviZZhtMniVJ+O+fT0PCMUD34+SE0O138sRdpW9/PeQ12pvg5nV0PvHR3Eyn X-Received: by 2002:a17:902:b604:: with SMTP id b4-v6mr10452993pls.32.1518428826388; Mon, 12 Feb 2018 01:47:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518428826; cv=none; d=google.com; s=arc-20160816; b=Jjr+ttCRktj0Ia1o3U9cfpf6E3nKIEOTH76cnK6ri989BsjMD/ecN3uhg5sRwbddwD PPKtk+2MdJC5ZoSho59RtxDzJm13+c+FSpFCED5DaVHasSh/oAe4uVI9/EzedFm3zRsc AfJRPqUiU8/+9ckkY6yC9iGBx0qqoZfgkm3T/yxssU2McSO/bFLxGPz2ZROK1pVQ9heX oH94WBTuShK1mStydhN9Xat3iY8savp/IaJaQDsipdx9t3WvcjxOea4aj+cKlmwkSzuf ixAmeO+LYkGHfaW1NdZ/E8J9OdV8ht27puQ7B/9DzktT9W0MrpMHZT71Djf9UAJSVnPO b2Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=7o3cWSffQjcc/6tpjPF0NlQGiblMxP4snBQx9YjMKnA=; b=bOkZvkW3yNd8qqDH3humbPEdBgrLTqVAeNMsERz+ANeUsrkMH0RMpswR5Ab5+kEDRd /ORE4AnbwpR75XTD2hVO42G/e+a64yFZKgZKOvGX8DHXeIKNo5Yt5EGzowDIeD0kpZDU BJkw55lcbr+vqteX6f0Y9x0Xa0raT+u+YtxuKjs+s8UEmL7nnUeYFs+BoUgTOrJIQXQv NzxLt/Kh0pc3NHTKX6KGHcEiz5qb6Rz8mAz+RqiRAzzXVNjRdx+4KjwB8t3Z1/cC0qZ5 K5gPI3C8tEuDuw7vC0RwMamjWuQFGDYOcGiW6AK0wYfWg5hJqr3rjmmpSmYIE/1VkbhE 8yAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=cnVxlJye; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id y14si4943393pgs.701.2018.02.12.01.47.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 01:47:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=cnVxlJye; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 998A86E1D7; Mon, 12 Feb 2018 09:45:51 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllnx210.ext.ti.com (fllnx210.ext.ti.com [198.47.19.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id A64546E173 for ; Mon, 12 Feb 2018 09:45:49 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1C9jlGR009915; Mon, 12 Feb 2018 03:45:47 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1518428747; bh=vaWN4YYnvPxt9ADP7AOFpYsWJHCoTcwaqZpsYhUfLR0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=cnVxlJyeOPxQLhBeUm3De4uNa6rsq2ERjHCCf0FBBigA9jkkSloo5NpdCkDW/uAhG ZBly0/vOSau0SmXrZ8bFwXvymqwQiSWPthNE878TXkEyGH0Hz0tcl0mfWmuoreOK4M VhSLaQt3gbUSQb5Ntl0syPDt+Y8TMj++bVEKVCMU= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9jlcM020844; Mon, 12 Feb 2018 03:45:47 -0600 Received: from DLEE113.ent.ti.com (157.170.170.24) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 12 Feb 2018 03:45:47 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 12 Feb 2018 03:45:47 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9j0NL003439; Mon, 12 Feb 2018 03:45:45 -0600 From: Tomi Valkeinen To: , Laurent Pinchart , Peter Ujfalusi , Jyri Sarha , Benoit Parrot Subject: [PATCH 24/24] drm/omap: cleanup color space conversion Date: Mon, 12 Feb 2018 11:44:54 +0200 Message-ID: <1518428694-18018-25-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> References: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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: Tomi Valkeinen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The setup code for color space conversion is a bit messy. This patch cleans it up. For some reason the TRM uses values in YCrCb order, which is also used in the current driver, whereas everywhere else it's YCbCr (which also matches YUV order). This patch changes the tables to use the common order to avoid confusion. The tables are split into separate lines, and comments added for clarity. WB color conversion registers are similar but different than non-WB, but the same function was used to write both. It worked fine because the coef table was adjusted accordingly, but that was rather confusing. This patch adds a separate function to write the WB values so that the coef table can be written in an understandable way. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/dss/dispc.c | 59 +++++++++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c index ff09e2be470f..697274317f7c 100644 --- a/drivers/gpu/drm/omapdrm/dss/dispc.c +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c @@ -345,11 +345,6 @@ static const struct { }, }; -struct color_conv_coef { - int ry, rcr, rcb, gy, gcr, gcb, by, bcr, bcb; - int full_range; -}; - static unsigned long dispc_fclk_rate(void); static unsigned long dispc_core_clk_rate(void); static unsigned long dispc_mgr_lclk_rate(enum omap_channel channel); @@ -841,9 +836,18 @@ static void dispc_ovl_set_scale_coef(enum omap_plane_id plane, int fir_hinc, } } +struct csc_coef_yuv2rgb { + int ry, rcb, rcr, gy, gcb, gcr, by, bcb, bcr; + bool full_range; +}; + +struct csc_coef_rgb2yuv { + int yr, yg, yb, cbr, cbg, cbb, crr, crg, crb; + bool full_range; +}; static void dispc_ovl_write_color_conv_coef(enum omap_plane_id plane, - const struct color_conv_coef *ct) + const struct csc_coef_yuv2rgb *ct) { #define CVAL(x, y) (FLD_VAL(x, 26, 16) | FLD_VAL(y, 10, 0)) @@ -853,7 +857,24 @@ static void dispc_ovl_write_color_conv_coef(enum omap_plane_id plane, dispc_write_reg(DISPC_OVL_CONV_COEF(plane, 3), CVAL(ct->bcr, ct->by)); dispc_write_reg(DISPC_OVL_CONV_COEF(plane, 4), CVAL(0, ct->bcb)); - REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), ct->full_range, 11, 11); + REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), !!ct->full_range, 11, 11); + +#undef CVAL +} + +static void dispc_wb_write_color_conv_coef(const struct csc_coef_rgb2yuv *ct) +{ + const enum omap_plane_id plane = OMAP_DSS_WB; + +#define CVAL(x, y) (FLD_VAL(x, 26, 16) | FLD_VAL(y, 10, 0)) + + dispc_write_reg(DISPC_OVL_CONV_COEF(plane, 0), CVAL(ct->yg, ct->yr)); + dispc_write_reg(DISPC_OVL_CONV_COEF(plane, 1), CVAL(ct->crr, ct->yb)); + dispc_write_reg(DISPC_OVL_CONV_COEF(plane, 2), CVAL(ct->crb, ct->crg)); + dispc_write_reg(DISPC_OVL_CONV_COEF(plane, 3), CVAL(ct->cbg, ct->cbr)); + dispc_write_reg(DISPC_OVL_CONV_COEF(plane, 4), CVAL(0, ct->cbb)); + + REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), !!ct->full_range, 11, 11); #undef CVAL } @@ -862,20 +883,28 @@ static void dispc_setup_color_conv_coef(void) { int i; int num_ovl = dispc_get_num_ovls(); - const struct color_conv_coef ctbl_bt601_5_ovl = { - /* YUV -> RGB */ - 298, 409, 0, 298, -208, -100, 298, 0, 517, 0, + + /* YUV -> RGB, ITU-R BT.601, limited range */ + const struct csc_coef_yuv2rgb coefs_yuv2rgb_bt601_lim = { + 298, 0, 409, /* ry, rcb, rcr */ + 298, -100, -208, /* gy, gcb, gcr */ + 298, 516, 0, /* by, bcb, bcr */ + false, /* limited range */ }; - const struct color_conv_coef ctbl_bt601_5_wb = { - /* RGB -> YUV */ - 66, 129, 25, 112, -94, -18, -38, -74, 112, 0, + + /* RGB -> YUV, ITU-R BT.601, limited range */ + const struct csc_coef_rgb2yuv coefs_rgb2yuv_bt601_lim = { + 66, 129, 25, /* yr, yg, yb */ + -38, -74, 112, /* cbr, cbg, cbb */ + 112, -94, -18, /* crr, crg, crb */ + false, /* limited range */ }; for (i = 1; i < num_ovl; i++) - dispc_ovl_write_color_conv_coef(i, &ctbl_bt601_5_ovl); + dispc_ovl_write_color_conv_coef(i, &coefs_yuv2rgb_bt601_lim); if (dispc.feat->has_writeback) - dispc_ovl_write_color_conv_coef(OMAP_DSS_WB, &ctbl_bt601_5_wb); + dispc_wb_write_color_conv_coef(&coefs_rgb2yuv_bt601_lim); } static void dispc_ovl_set_ba0(enum omap_plane_id plane, u32 paddr)