From patchwork Wed Nov 1 09:17:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13442648 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C1857C4332F for ; Wed, 1 Nov 2023 09:18:43 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1FA7910E66F; Wed, 1 Nov 2023 09:18:38 +0000 (UTC) Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4871D10E00C for ; Wed, 1 Nov 2023 09:18:36 +0000 (UTC) Received: from [127.0.1.1] (91-158-149-209.elisa-laajakaista.fi [91.158.149.209]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D826E7F8; Wed, 1 Nov 2023 10:18:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1698830298; bh=gkIBd5+fMV46AC7d0uwLpkNL1fVDY+8sAYxHxQO4ANk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=o2mRwQzu+y+EV3qM9yFl6nfauKT2y7VcnTtn8wCh+NPKjDdmlxzVOFIouNOYvo3/Q wPTnw/uwXe0nrTTwCbKXII0J4TBcA02J7f2pW9Z09jJaPX+ss56DPnzQhBDbW8eNn5 wazuHRifULXVGzoeuY+EkIOl8P8uAakZgHC8Rpec= From: Tomi Valkeinen Date: Wed, 01 Nov 2023 11:17:38 +0200 Subject: [PATCH 01/10] drm/tidss: Use pm_runtime_resume_and_get() MIME-Version: 1.0 Message-Id: <20231101-tidss-probe-v1-1-45149e0f9415@ideasonboard.com> References: <20231101-tidss-probe-v1-0-45149e0f9415@ideasonboard.com> In-Reply-To: <20231101-tidss-probe-v1-0-45149e0f9415@ideasonboard.com> To: Aradhya Bhatia , Devarsh Thakkar , Jyri Sarha , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=905; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=gkIBd5+fMV46AC7d0uwLpkNL1fVDY+8sAYxHxQO4ANk=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBlQhflp0H+oMJh4AKSQ1Ir0s9axU9mj4Jd5D82W 7KdfFko9HaJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZUIX5QAKCRD6PaqMvJYe 9bCTD/9V0Lh/Xns/cGwDrdHS5OhAzc26iltUq4huG/4tVJYYv2XmPd6R+VH0Z8s9o1C7I3yiunU j9QZRslEBhzf/Tz/uFfzTjPyGxLOlMRxol0YP2oljPMFCX2O440hxKRddhpFRKCq9INj8gq2NFX 8txW/8WLqURoHLOmv8CBL7ANxceY9iMp3ISW+UPBtXo8wlX0P8pircepSn9/dbhlmdL5os9IOPN 4lhrv51b+9qGXKa1OWhI1izPJQthC370HFjrWghKPityx6WWX+iYhIHm9BAKdvK5JSVmoVLpDbe nNp+njQE+t64euRlO0153TDCoiiWcih/4AtUvbBV/PE937sMbqR9k7pxqIlZ9aLkd5XF18+v2we lMepM+F22FQVnK8Dzf6a5kNus7k90Nna0M+BIo3aol2IwPaBz1vIFJzYvtbmadUS7cMWhsOrzA1 FgKqlxWiz8rnrPUZwBsYezqwkuuIIO5dFXkmMkLGLpxgoHDeKjcmxhztSdnYMqvzEWvVndOergC HptBTmZ9F8j4yTSZzGMiMB8TP9l1tzI0X7sGeByKSj4HAdZ06ZngsL4PjEw/bD8fDw1Or7oxYIH xMJ5S88qA4SSXUpP5vwhUgmSv+NERyMT/PMDmUodnZkbRNMuXyAnL2Wh9CCQAntk81Lihb5ihPp G5Tr9Nl2jbqdrSA== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomi Valkeinen , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Laurent Pinchart Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Use pm_runtime_resume_and_get() instead of pm_runtime_get_sync(), which will handle error situations better. Also fix the return, as there should be no reason for the current complex return. Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/tidss/tidss_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/tidss/tidss_drv.c b/drivers/gpu/drm/tidss/tidss_drv.c index 4d063eb9cd0b..f403db11b846 100644 --- a/drivers/gpu/drm/tidss/tidss_drv.c +++ b/drivers/gpu/drm/tidss/tidss_drv.c @@ -32,9 +32,9 @@ int tidss_runtime_get(struct tidss_device *tidss) dev_dbg(tidss->dev, "%s\n", __func__); - r = pm_runtime_get_sync(tidss->dev); + r = pm_runtime_resume_and_get(tidss->dev); WARN_ON(r < 0); - return r < 0 ? r : 0; + return r; } void tidss_runtime_put(struct tidss_device *tidss) From patchwork Wed Nov 1 09:17:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13442649 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 653E9C4167B for ; Wed, 1 Nov 2023 09:18:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9F1CB10E674; Wed, 1 Nov 2023 09:18:39 +0000 (UTC) Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0430F10E051 for ; Wed, 1 Nov 2023 09:18:37 +0000 (UTC) Received: from [127.0.1.1] (91-158-149-209.elisa-laajakaista.fi [91.158.149.209]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A68F68E1; Wed, 1 Nov 2023 10:18:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1698830299; bh=xQfh4wFKSK2nLKdijYY1UXEQqCMe4QymvcSpQaHogdw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=jPCXMnQlK5QA+NqQ5hjcsWNTq9cQXbhcyJgOPZIsF3DARySjdLJKLrzvGIgX2DK8F dzT80FHD5Wsl45jzxgy8UwRwhwUJXqL078FLSXGQIG8tw7YZ1RT+i0sCRqaAH6L0fN 43tT3dMXxEHYncXH15dYGEBAld5wukbngtbxCqN0= From: Tomi Valkeinen Date: Wed, 01 Nov 2023 11:17:39 +0200 Subject: [PATCH 02/10] drm/tidss: Use PM autosuspend MIME-Version: 1.0 Message-Id: <20231101-tidss-probe-v1-2-45149e0f9415@ideasonboard.com> References: <20231101-tidss-probe-v1-0-45149e0f9415@ideasonboard.com> In-Reply-To: <20231101-tidss-probe-v1-0-45149e0f9415@ideasonboard.com> To: Aradhya Bhatia , Devarsh Thakkar , Jyri Sarha , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=1500; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=xQfh4wFKSK2nLKdijYY1UXEQqCMe4QymvcSpQaHogdw=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBlQhfm0I1aAJ++gXl9qnfA5qLiH+x6aRiH7mAW5 zUZv9k+nuiJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZUIX5gAKCRD6PaqMvJYe 9YG1D/40auunKVvVoDGofklPD3crxDwf0t3XWtc9ifEcq1Es7pzT0bGRlJEA/QtVknEd/WoaMId VTEE0zkuesRfqrb7FWvPVzfmPypjevvBvfh5bzYBHykZM1weROy5rM50aCM8C8bcNycTnKtNiN4 35TvD/cCYulFpH0TCDuNFk6CyR4agCnmar6JtbbDNG4BgIW1fq0knzLAuAdK/nRnPMb1Flv+b/C KHPFKCC4FfCuauDhpk4ddsjJlGeLSu8XpLMuP6tWWV/LmDG6BfRtmP23yWXz3Pq8g+knewoN9GP odpXfOP1ZOA0HTW15vQsQiTypWsFnaHd/Mn2DqD/EvtAisfp102e47UJg6gKsU/6WwNbcIvhV6U mh6mfko8ilsMa2IkR4vmOYG/Guwa8DGkOfDiDhe397tHt9HzkBBPreIPVuuYVhbplrMGAcK/7jk U0cfZIOrGVE2hSF9Tcq7HUtk0UJQrZ22m5d2i7FWU1SbcuTRJ6iPLejmPWf2/5ZOyneZgWBpX2u /d650d6D3am8cYYyoqL0RtWdUt7knVMZ033HahQzpdkBObMxYkHiJYAGFWjfkV80CKXqnjwIIpj /AaG24xgseqw8ZH94ivjlxH6Swc6QYlVbMsoa/HID6JhXelZoBfdy6WjRvYPQmJMcYwrkwzfy6v tn0raEbb3/qropw== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomi Valkeinen , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Laurent Pinchart Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Use runtime PM autosuspend feature, with 1s timeout, to avoid unnecessary suspend-resume cycles when, e.g. the userspace temporarily turns off the crtcs when configuring the outputs. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/tidss/tidss_drv.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/tidss/tidss_drv.c b/drivers/gpu/drm/tidss/tidss_drv.c index f403db11b846..64914331715a 100644 --- a/drivers/gpu/drm/tidss/tidss_drv.c +++ b/drivers/gpu/drm/tidss/tidss_drv.c @@ -43,7 +43,9 @@ void tidss_runtime_put(struct tidss_device *tidss) dev_dbg(tidss->dev, "%s\n", __func__); - r = pm_runtime_put_sync(tidss->dev); + pm_runtime_mark_last_busy(tidss->dev); + + r = pm_runtime_put_autosuspend(tidss->dev); WARN_ON(r < 0); } @@ -144,6 +146,9 @@ static int tidss_probe(struct platform_device *pdev) pm_runtime_enable(dev); + pm_runtime_set_autosuspend_delay(dev, 1000); + pm_runtime_use_autosuspend(dev); + #ifndef CONFIG_PM /* If we don't have PM, we need to call resume manually */ dispc_runtime_resume(tidss->dispc); @@ -215,6 +220,7 @@ static void tidss_remove(struct platform_device *pdev) /* If we don't have PM, we need to call suspend manually */ dispc_runtime_suspend(tidss->dispc); #endif + pm_runtime_dont_use_autosuspend(dev); pm_runtime_disable(dev); /* devm allocated dispc goes away with the dev so mark it NULL */ From patchwork Wed Nov 1 09:17:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13442650 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A3F46C001B2 for ; Wed, 1 Nov 2023 09:18:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CA6CE10E679; Wed, 1 Nov 2023 09:18:39 +0000 (UTC) Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id A4A6310E672 for ; Wed, 1 Nov 2023 09:18:37 +0000 (UTC) Received: from [127.0.1.1] (91-158-149-209.elisa-laajakaista.fi [91.158.149.209]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 76788D8B; Wed, 1 Nov 2023 10:18:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1698830300; bh=cqr9qmnFL43Mi0X/si5rR0wyx9x15IoN3blFgEcAEhY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=QtWevdGxZ8j6lFrOZSDySoZ8OFG//OIF6lsjV4Rfe1bhm4ZcUopLubuWCahTy4pRH Csc3evlzCSnuoaSdwACFMFKoLR/J6OqoXXNhnMOkbgQYkJ6pbmfQcMHrxXu3jfO5Kl eOuCzrLYjQ1Mx76jlI5T6wtE4bViQ670xn/0KjMU= From: Tomi Valkeinen Date: Wed, 01 Nov 2023 11:17:40 +0200 Subject: [PATCH 03/10] drm/tidss: Drop useless variable init MIME-Version: 1.0 Message-Id: <20231101-tidss-probe-v1-3-45149e0f9415@ideasonboard.com> References: <20231101-tidss-probe-v1-0-45149e0f9415@ideasonboard.com> In-Reply-To: <20231101-tidss-probe-v1-0-45149e0f9415@ideasonboard.com> To: Aradhya Bhatia , Devarsh Thakkar , Jyri Sarha , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=708; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=cqr9qmnFL43Mi0X/si5rR0wyx9x15IoN3blFgEcAEhY=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBlQhfmZvrXwVfeAXpKfH/t84dOn0jl1YydKNIAp 4Tb85mAQMyJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZUIX5gAKCRD6PaqMvJYe 9dq1D/9dvYn6n3xz8Hjqt40LO0+SBnW3EclIBin6YRnFpRYTkAcGD5/If7zbmwBilpE30tQs50H X8BE0m2ZZrWnSyC0zzWG0hUmdmSoalIR2kfNXS9l+hdJ4sTY1HCkMX30EbAXbCWdvFqi9N7xoYN btOEe49slqZhQczeK6/ILzdUnxUhMlvmktqb2Zd0A4xeGlxHBKur7rpB48+GiS1dH8veEJT5mAr FXd1kZjxAHjUZqYvXx293BAKaMtyh3FXsQVhCGx0MrmfpL4QnoCummdCZfiCuFn68LGTodiP2YB +c/bw7IMyu37R1Evmd409EBXE+pBiNbk3EcR9Qs7i4nal+KZubWHmhA6DSumDLy5rhXHBXD+B09 Ddr8qy02PgfLOXzS3QQxfS97ifltB6gZV26CNmbglV9DNPaK/qi4Neylwwy9ierje0zbaRriRuQ 0b7kruM7DKsHqvl3e60MHop9sYYICBWoOEFZEByuFA7b3eXw6YNzNrO8DuipN+YEwkrnxJN6bjG PZ8xHAY+LLDMpjsy2Iil2PqFBPc4GV3EuxNzYG89oqZ+jUJXwL6Zt0D9rXu/VraWyG3uZcCoFFp d80YfWbmFYs533LFOvrEIkd5MgNIPchPnwBW8Fk5ZIQAckMGk3isUWKt0EbcruvG4EiOgv2+1gd BogoFbcu0cTNDig== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomi Valkeinen , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Laurent Pinchart Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" No need to initialize the ret to 0 in dispc_softreset(). Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/tidss/tidss_dispc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/tidss/tidss_dispc.c b/drivers/gpu/drm/tidss/tidss_dispc.c index 9d9dee7abaef..ad7999434299 100644 --- a/drivers/gpu/drm/tidss/tidss_dispc.c +++ b/drivers/gpu/drm/tidss/tidss_dispc.c @@ -2705,7 +2705,7 @@ static void dispc_init_errata(struct dispc_device *dispc) static void dispc_softreset(struct dispc_device *dispc) { u32 val; - int ret = 0; + int ret; /* Soft reset */ REG_FLD_MOD(dispc, DSS_SYSCONFIG, 1, 1, 1); From patchwork Wed Nov 1 09:17:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13442656 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1CBE1C4332F for ; Wed, 1 Nov 2023 09:19:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8C4B710E678; Wed, 1 Nov 2023 09:18:44 +0000 (UTC) Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7227D10E676 for ; Wed, 1 Nov 2023 09:18:38 +0000 (UTC) Received: from [127.0.1.1] (91-158-149-209.elisa-laajakaista.fi [91.158.149.209]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 44C9AE52; Wed, 1 Nov 2023 10:18:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1698830300; bh=9o8g+vSUQSS3NMbFAfGUkXi52cmu6Vb3V663gNfc4iY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=p/T0QMM11m5z3vXdBLD95kfaCJDQgXUYH5Y18q6/1yRkfjNCHx0NLbSThIUxS7tU4 n5Nt8UGErZQpNfl7nnGoYcP+aG5UNHdeH2wppHR5/vNDnl3h+kjgjYiDgE09SfbMga iEIgrs5XSnvSPf8iSJv9fEfZiJBSDXqhj+NATuO4= From: Tomi Valkeinen Date: Wed, 01 Nov 2023 11:17:41 +0200 Subject: [PATCH 04/10] drm/tidss: Move reset to the end of dispc_init() MIME-Version: 1.0 Message-Id: <20231101-tidss-probe-v1-4-45149e0f9415@ideasonboard.com> References: <20231101-tidss-probe-v1-0-45149e0f9415@ideasonboard.com> In-Reply-To: <20231101-tidss-probe-v1-0-45149e0f9415@ideasonboard.com> To: Aradhya Bhatia , Devarsh Thakkar , Jyri Sarha , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=1363; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=9o8g+vSUQSS3NMbFAfGUkXi52cmu6Vb3V663gNfc4iY=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBlQhfmqKrrOflLOTzV3Rkv9Kbh/MN1PuuDm8/ON sPnotTWnrSJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZUIX5gAKCRD6PaqMvJYe 9WbBD/4mv6KLlnj3Gja378NvTcc+TdWKrXms3LxA6LYYNBr9MZP8NrejQnGyZ2scbA9TseQaLKl xqtmW3v5E0vgnfbFCxnvRpSiMN5LFF49++VbMbNUR9OBmNhhAIVKDdRnqefYS3q4f1AHfHWXriV siw+rcnKIWQGXm7PHo4JqLA6SCXpYmzQfuHkplxtl8UBki8/HiX/PxsUmizmZfLlTRZ9E+6THwV A6Bc69316TyAu4A+n6rPZqlEnVqZc5qzQZLndYj1/39Smem4725r1nE7jtsjPuKV2H0NgEinXQi qU+F9mA8H2KkiIwipJ4VyXgsjJCI+mRrsfPCeLDYwsF6sUX1O22/Na84WPcfZxrIaah6hvGejl2 ooEtZWgv5kqzRvw8A1hzsdSHwhikoKrYWu+vAFrKuRGRcvoJVJvvusoQUwOsMbg6f/n2yxJVMGd B3m7pIw3P5gzug99n3Je2D+KRpe9pfsMwWkqfO21Elw5xsrhhfDTuFeCbjxyQU7i54W3b1aak/i vYF+fOJYdx39Ld3wUzYz2+aJ1P7/OSZLb2gwBgYusMPb3e1lleR491ykd2XgM/w3hih3KZjDoYA fjuUhfMR6SJnmnPbGQ+U5qNsfPdevqyjfvtNjlvk2ideK0ZJxRaqF8rAduvr+VsLOSonkJo0R97 cm0/hvJnAwW77sg== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomi Valkeinen , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Laurent Pinchart Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" We do a DSS reset in the middle of the dispc_init(). While that happens to work now, we should really make sure that e..g the fclk, which is acquired only later in the function, is enabled when doing a reset. This will be handled in a later patch, but for now, let's move the dispc_softreset() call to the end of dispc_init(), which is a sensible place for it anyway. Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/tidss/tidss_dispc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/tidss/tidss_dispc.c b/drivers/gpu/drm/tidss/tidss_dispc.c index ad7999434299..9430625e2d62 100644 --- a/drivers/gpu/drm/tidss/tidss_dispc.c +++ b/drivers/gpu/drm/tidss/tidss_dispc.c @@ -2777,10 +2777,6 @@ int dispc_init(struct tidss_device *tidss) return r; } - /* K2G display controller does not support soft reset */ - if (feat->subrev != DISPC_K2G) - dispc_softreset(dispc); - for (i = 0; i < dispc->feat->num_vps; i++) { u32 gamma_size = dispc->feat->vp_feat.color.gamma_size; u32 *gamma_table; @@ -2831,5 +2827,9 @@ int dispc_init(struct tidss_device *tidss) tidss->dispc = dispc; + /* K2G display controller does not support soft reset */ + if (feat->subrev != DISPC_K2G) + dispc_softreset(dispc); + return 0; } From patchwork Wed Nov 1 09:17:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13442651 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C2EF0C4167B for ; Wed, 1 Nov 2023 09:18:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 88A9010E057; Wed, 1 Nov 2023 09:18:40 +0000 (UTC) Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 451B310E674 for ; Wed, 1 Nov 2023 09:18:39 +0000 (UTC) Received: from [127.0.1.1] (91-158-149-209.elisa-laajakaista.fi [91.158.149.209]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 13D1CEBA; Wed, 1 Nov 2023 10:18:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1698830301; bh=S/kuLWe0/nj3sw3ZBJIao5fLsRqSmlViPlkeBKEBUQc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=no3GrqbzK1UujstiZXCJVuUv7Mcpud6+l24s6as4ZbU3u/oLVHB2tRotlu5k19KxN 9+idXiFKTkvtoFWQTKaQg+q4Fg+JF2djnc7v47c1BB78L3apgD4PTQoG8h4MWF0/E8 fq+AP+6rSrszotUKmJIbcidaz/yWwEB1nZkFgf5A= From: Tomi Valkeinen Date: Wed, 01 Nov 2023 11:17:42 +0200 Subject: [PATCH 05/10] drm/tidss: Return error value from from softreset MIME-Version: 1.0 Message-Id: <20231101-tidss-probe-v1-5-45149e0f9415@ideasonboard.com> References: <20231101-tidss-probe-v1-0-45149e0f9415@ideasonboard.com> In-Reply-To: <20231101-tidss-probe-v1-0-45149e0f9415@ideasonboard.com> To: Aradhya Bhatia , Devarsh Thakkar , Jyri Sarha , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=1510; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=S/kuLWe0/nj3sw3ZBJIao5fLsRqSmlViPlkeBKEBUQc=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBlQhfnWpbjq0FmByn/it3hJbiT/5wcGPbCtB5wx x/FViL/nd6JAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZUIX5wAKCRD6PaqMvJYe 9dMMEACfTV1kbW+dXwkE+Qjo8LSLkYv9SpTgPBR2Aa2pKpVsSVrR24lTlZSPr6rfbfSq6DiEsJa 1xWCBXpIDJKRpGMC71F1eJcxEM/LFAyheLlaUDWVVZHvpoBykIFdu3IM2uOj5YEJaK+eLfTbo8j sFAifLjFZW+jAlPewmtsrdoJ20STrj79yQfz+ecehp77UJqn4FUu8fKfC5iIunWSep4dVUAwBAI /0+rDy5391vbYY2goyXY5cJxC2WlCBkpLJtsdG1r9q7+axeas8KQ0L8K3HYe6P6iXNBIn+WKqku qLmbiveR+PKQ5KPYw0ZsQbm2t4ezTAMWbDob4p4GdPQ81ohHXXoVLLTjSMjPrU5fhDs612gj5mW EBsW0cTro9V3xSrn1UaWbU3fbeVNNPvUWGgIJDwVUVvZS8a3MC7idRsBtEebC0WbyoJTNTppaj5 d4Jv0JyJRmmTjZS4UgBRDXTypb3cVtjduQsGDXO/dMzUNWTfTgajF4kpAHxLPEVjurFEG3UfKFT YB3SAOsioj5XqH/iuwVRPBJNCdgANWh7mKdfwpi0M30yIfYSxGQJVkIOTzgJIc3unWGDZtKIBZI SrxLgRFRCty2R315gM9q5PKubhO5LKDUa9/dXPECgzXeytBXsL7X4uy5tOxGA6O2N4j4F/jtsOw GUNWxx5r7tmjHuw== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomi Valkeinen , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Laurent Pinchart Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Return an error value from dispc_softreset() so that the caller can handle the errors. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/tidss/tidss_dispc.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/tidss/tidss_dispc.c b/drivers/gpu/drm/tidss/tidss_dispc.c index 9430625e2d62..cdbb88289082 100644 --- a/drivers/gpu/drm/tidss/tidss_dispc.c +++ b/drivers/gpu/drm/tidss/tidss_dispc.c @@ -2702,7 +2702,7 @@ static void dispc_init_errata(struct dispc_device *dispc) } } -static void dispc_softreset(struct dispc_device *dispc) +static int dispc_softreset(struct dispc_device *dispc) { u32 val; int ret; @@ -2712,8 +2712,12 @@ static void dispc_softreset(struct dispc_device *dispc) /* Wait for reset to complete */ ret = readl_poll_timeout(dispc->base_common + DSS_SYSSTATUS, val, val & 1, 100, 5000); - if (ret) - dev_warn(dispc->dev, "failed to reset dispc\n"); + if (ret) { + dev_err(dispc->dev, "failed to reset dispc\n"); + return ret; + } + + return 0; } int dispc_init(struct tidss_device *tidss) @@ -2828,8 +2832,11 @@ int dispc_init(struct tidss_device *tidss) tidss->dispc = dispc; /* K2G display controller does not support soft reset */ - if (feat->subrev != DISPC_K2G) - dispc_softreset(dispc); + if (feat->subrev != DISPC_K2G) { + r = dispc_softreset(dispc); + if (r) + return r; + } return 0; } From patchwork Wed Nov 1 09:17:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13442652 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C0484C4167D for ; Wed, 1 Nov 2023 09:18:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CE2A810E00C; Wed, 1 Nov 2023 09:18:42 +0000 (UTC) Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 10EC110E00C for ; Wed, 1 Nov 2023 09:18:40 +0000 (UTC) Received: from [127.0.1.1] (91-158-149-209.elisa-laajakaista.fi [91.158.149.209]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D612C1B3C; Wed, 1 Nov 2023 10:18:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1698830302; bh=4dopl98SADPr+tiIFKErvb5eH1nysDYoa2k3ZOY9EwM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ZWszpq8oUANaP/RXTq+8FXQitKO5TmuevctXURULcSLeo0/8ZDCk9+mOfMsbYsrXP Ir47j0MBSyVwibN3gBjdS5yGtYdAtlEYfrvQ0gaA0xC2lp9ws82xRyGi79k+QwXrMv HJ1SLaOFbF0r5bdjEt/8NUty0KxuX/9rfHWFVGAs= From: Tomi Valkeinen Date: Wed, 01 Nov 2023 11:17:43 +0200 Subject: [PATCH 06/10] drm/tidss: Check for K2G in in dispc_softreset() MIME-Version: 1.0 Message-Id: <20231101-tidss-probe-v1-6-45149e0f9415@ideasonboard.com> References: <20231101-tidss-probe-v1-0-45149e0f9415@ideasonboard.com> In-Reply-To: <20231101-tidss-probe-v1-0-45149e0f9415@ideasonboard.com> To: Aradhya Bhatia , Devarsh Thakkar , Jyri Sarha , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=1267; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=4dopl98SADPr+tiIFKErvb5eH1nysDYoa2k3ZOY9EwM=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBlQhfnt2zJRKYOEVKle2omRjKY4to5bnItY7yFV UBMKQX0yUGJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZUIX5wAKCRD6PaqMvJYe 9YfsD/0RXpaIgePYT1v7DAYeRrhQdYLoVaUMtVgsDAY4cJD5eEkA66MdctQi73YMwSZ5NOwdyjh lu+geIwMOA5veWkJoF1elBDtFM0v654tsHaYcnJFlDauFOebKT1YjIxTlEEsus1ZdA4m79gP+L6 aH1OF0PVmMmhx98F3/COFwgKb7m8V1vplYZrZ0YNcMlji5VpzNd4g50SsE6Z2A3P2ci/i8X/smY x3WUxrdlbRDbXyKCoLbCYXlShIFK0ow65O6uT3jTMl4FjbY2aKkUHGHoTgOGoZ91VxWgtcztj+f 76WWHvhG0LBIWY9vFkwEToQXqlPv8CS1cOuTUKjL6mirU7HdnJkIpx+XyHUJngnA9uh552jIM8G 8f8nWWlMgxAteilgs7C3PCOCXu2u7B/6lHYiXZLdOAoRQufVSHx+nOuSL5MsyTCexCk1K9IVsWg ok6X7WI9yYtF9Z9xDK91a2FV+JgiO22/Y1rN2B3N6KkpXARyzC8NFL+JrFxnEn2fZgI4aWCDMcn +kZDSyVvNuwZyt9e4ABFpTbrZ2P05PXiVKtyFQfKFI+yc6gU8S8LEkrBTS9nY5fiKgZuJJs39sF J0RjkNOPS9ycQTTKW4mk8WuPAcv5HowYqIgv3EtuJgsKIBz+eoOjKuABSZa9LBexI6RxgLjfjMj peHnDQyTmxnO5nA== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomi Valkeinen , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Laurent Pinchart Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" K2G doesn't have softreset feature. Instead of having every caller of dispc_softreset() check for K2G, move the check into dispc_softreset(), and make dispc_softreset() return 0 in case of K2G. Signed-off-by: Tomi Valkeinen Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/tidss/tidss_dispc.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/tidss/tidss_dispc.c b/drivers/gpu/drm/tidss/tidss_dispc.c index cdbb88289082..f204a0701e9f 100644 --- a/drivers/gpu/drm/tidss/tidss_dispc.c +++ b/drivers/gpu/drm/tidss/tidss_dispc.c @@ -2707,6 +2707,10 @@ static int dispc_softreset(struct dispc_device *dispc) u32 val; int ret; + /* K2G display controller does not support soft reset */ + if (dispc->feat->subrev == DISPC_K2G) + return 0; + /* Soft reset */ REG_FLD_MOD(dispc, DSS_SYSCONFIG, 1, 1, 1); /* Wait for reset to complete */ @@ -2831,12 +2835,9 @@ int dispc_init(struct tidss_device *tidss) tidss->dispc = dispc; - /* K2G display controller does not support soft reset */ - if (feat->subrev != DISPC_K2G) { - r = dispc_softreset(dispc); - if (r) - return r; - } + r = dispc_softreset(dispc); + if (r) + return r; return 0; } From patchwork Wed Nov 1 09:17:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13442653 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 461DCC4332F for ; Wed, 1 Nov 2023 09:18:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E1DD110E658; Wed, 1 Nov 2023 09:18:42 +0000 (UTC) Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id D353010E00C for ; Wed, 1 Nov 2023 09:18:40 +0000 (UTC) Received: from [127.0.1.1] (91-158-149-209.elisa-laajakaista.fi [91.158.149.209]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A4C6F1BAE; Wed, 1 Nov 2023 10:18:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1698830303; bh=dkl3jtDooC1JFtaD0YoyJ131w9qjC5vo5eQl2h7Sweo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=X28UD5BsxO8OYz1iBNC/hEargVmbvL7kBwjtoMi4DnBqAbZdZszrGVIWyp4s7IAbd 1AVMmwshLM8JHaJF9zrLfFeCQiw9mP3h8QvHnB7ZqeYqMGPxhnBQd1qdX8h6NcqhVh dXK95kbx1eUUPcBu2f0noTr9DHcB7CGyqUs9AbLc= From: Tomi Valkeinen Date: Wed, 01 Nov 2023 11:17:44 +0200 Subject: [PATCH 07/10] drm/tidss: Fix dss reset MIME-Version: 1.0 Message-Id: <20231101-tidss-probe-v1-7-45149e0f9415@ideasonboard.com> References: <20231101-tidss-probe-v1-0-45149e0f9415@ideasonboard.com> In-Reply-To: <20231101-tidss-probe-v1-0-45149e0f9415@ideasonboard.com> To: Aradhya Bhatia , Devarsh Thakkar , Jyri Sarha , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=2654; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=dkl3jtDooC1JFtaD0YoyJ131w9qjC5vo5eQl2h7Sweo=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBlQhfnclbJel7gQ5GXPPWj5UOUtsFOinZZ0pugH /NxyVI+gV+JAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZUIX5wAKCRD6PaqMvJYe 9XdDD/9FXC7yP4L2ixb760gH7/wVpJyGAsTsAlYaoBTFTw5xeGwhs8RjwMtFnhLBbF5zmmMqyNF OxZnojctXWY/mBYxSHUjx/a9PELtelP094ZjhLD9EG4Ng4GiPRst8TMeE8DhioLT+b0E66EevUf /FObJE4gO2GA1AXutg7+AHqAXIoFXS5E67u4rJuRbOzbfTyOW5R/NhVp2IcCQGxMAMFcINI1/gW kKlX7uos1wVdGxsWnQkezqPjrLodBtph11X+URZvvnUlKtJDXc8+UwtJHx06axtrPHZd88NL6U/ EMmY6NQ5GHscG/6GmskW2ojmPIF1M1VyfFzFwkxt5pi95dhfOn02C8IOmyGY/tOBPWDZa237Yk7 G9xRRjuJ6jJTO/Cu6WKL0fW5HDkIA0kg3i93lvSOBHleAcvqBTo9FnvviNEPdlw+BJMbsMErdPH RFnvCGWdgEk/6F/JulnQ1UW5E9ObYsQ0RjmbmC1mO68zShNkdQ34cE+gJ9SRBRAr9QSBfF5XKHZ IbEr5z0JPIapFTgVYGFCxjXDS2rWq974WtIk/f1KBKKr7i10KU+cp/lY1omCsH1hjeGpMwWYVuL j01zWpoSgc3ciZJVzOOM3aNlZo3gABubkDqOPk2VKmhXhDJ9sC8pyCNZIvHRWWnJfHRayHKAQ2y 3uSypv0sboLvj8Q== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomi Valkeinen , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Laurent Pinchart Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The probe function calls dispc_softreset() before runtime PM is enabled and without enabling any of the DSS clocks. This happens to work by luck, and we need to make sure the DSS HW is active and the fclk is enabled. To fix the above, add a new function, dispc_init_hw(), which does: - pm_runtime_set_active() - clk_prepare_enable(fclk) - dispc_softreset(). This ensures that the reset can be successfully accomplished. Note that we use pm_runtime_set_active(), not the normal pm_runtime_get(). The reason for this is that at this point we haven't enabled the runtime PM yet and also we don't want the normal resume callback to be called: the dispc resume callback does some initial HW setup, and it expects that the HW was off (no video ports are streaming). If the bootloader has enabled the DSS and has set up a boot time splash-screen, the DSS would be enabled and streaming which might lead to issues with the normal resume callback. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/tidss/tidss_dispc.c | 45 ++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/tidss/tidss_dispc.c b/drivers/gpu/drm/tidss/tidss_dispc.c index f204a0701e9f..13db062892e3 100644 --- a/drivers/gpu/drm/tidss/tidss_dispc.c +++ b/drivers/gpu/drm/tidss/tidss_dispc.c @@ -2724,6 +2724,49 @@ static int dispc_softreset(struct dispc_device *dispc) return 0; } +static int dispc_init_hw(struct dispc_device *dispc) +{ + struct device *dev = dispc->dev; + int ret; + + ret = pm_runtime_set_active(dev); + if (ret) { + dev_err(dev, "Failed to set DSS PM to active\n"); + return ret; + } + + ret = clk_prepare_enable(dispc->fclk); + if (ret) { + dev_err(dev, "Failed to enable DSS fclk\n"); + goto err_runtime_suspend; + } + + ret = dispc_softreset(dispc); + if (ret) + goto err_clk_disable; + + clk_disable_unprepare(dispc->fclk); + ret = pm_runtime_set_suspended(dev); + if (ret) { + dev_err(dev, "Failed to set DSS PM to suspended\n"); + return ret; + } + + return 0; + +err_clk_disable: + clk_disable_unprepare(dispc->fclk); + +err_runtime_suspend: + ret = pm_runtime_set_suspended(dev); + if (ret) { + dev_err(dev, "Failed to set DSS PM to suspended\n"); + return ret; + } + + return ret; +} + int dispc_init(struct tidss_device *tidss) { struct device *dev = tidss->dev; @@ -2835,7 +2878,7 @@ int dispc_init(struct tidss_device *tidss) tidss->dispc = dispc; - r = dispc_softreset(dispc); + r = dispc_init_hw(dispc); if (r) return r; From patchwork Wed Nov 1 09:17:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13442655 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D89E3C0018C for ; Wed, 1 Nov 2023 09:18:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0E07910E672; Wed, 1 Nov 2023 09:18:44 +0000 (UTC) Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9D22010E00C for ; Wed, 1 Nov 2023 09:18:41 +0000 (UTC) Received: from [127.0.1.1] (91-158-149-209.elisa-laajakaista.fi [91.158.149.209]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 73F1F1BB1; Wed, 1 Nov 2023 10:18:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1698830304; bh=XebHXvtm9Gfpkkb4vxBLxt9Z+vX/euBnejSOchv4oXo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=N4Lf32+MT3uYNIlocIzcnORczhVJRTG3EGbyQNJkYJ+uIw4qQIRTY1ccLlYdR4oFp 1VgWWQr4sCpl4Fua3bZPcz+uDottvhUeetdyYc9FKCcl2X9y1cilDYUGcg2vlPNdZ2 Z2N9MgEpQLQYU1FG744fbCxx6y0UNVFmb5QZaAAU= From: Tomi Valkeinen Date: Wed, 01 Nov 2023 11:17:45 +0200 Subject: [PATCH 08/10] drm/tidss: Add dispc_is_idle() MIME-Version: 1.0 Message-Id: <20231101-tidss-probe-v1-8-45149e0f9415@ideasonboard.com> References: <20231101-tidss-probe-v1-0-45149e0f9415@ideasonboard.com> In-Reply-To: <20231101-tidss-probe-v1-0-45149e0f9415@ideasonboard.com> To: Aradhya Bhatia , Devarsh Thakkar , Jyri Sarha , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=1637; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=XebHXvtm9Gfpkkb4vxBLxt9Z+vX/euBnejSOchv4oXo=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBlQhfouctsmX1lsKBLN4hTuScM6P6dOalET/fhs HZs+OBlhFmJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZUIX6AAKCRD6PaqMvJYe 9ZLdEACvwMBfXZe0UFUyJAWitzqcRdI8rq8Fv/GHlhHVRw6N5qjExuo05m0ZiCJ6WIRz9xkTK2K zAk+ELQ45A7rymVJBlRzVnEdfKOrpYltqBFjJKtN86fyj/9QuSmpnlgqMVvVeP0QjHEVbM1x67n /v1xfm0zSLtYWjB4sXzrDAHxcQUIVc6SCOGDGAITlg1Wblo5ZyRUzOeOGJTg7jovU6OCPXRY8jD c9x7sXrml0VY+hv/IvmVTDqE1opMxhcSBdOWmNAoRMPObo2jAMt5OnsdP3sGvVErVmFd6y3e5aK vnWSbTv4yGyZdwRueI9dIztZkn/hQj9HNHUTtokEI2yvGny8gI3tDIG7bR+WP5d7jNfT9i+sjp0 WggxHMj/poiPeMIZyTV8tLQx2kZ+repaWIw+1O4sFL+AIL6fvS0/pDx8cGDs23VY+A7+Je3dMIs VvD22BMSLeRDdilvHDEm5VhM27fxm5KZybEYtLWO2cfsdO1TzuFd9OjAHBNOkwg+0B2G5i2soET ZXakM7ynJ6Ywl6+Ougzskf3YSSJgQPZGrAuR2hOMAY6BTVMYaPuDC8aZrwRqRY6M7Fw2wwymt7K iDGIuOn5dXSMwPoiz2Yz6xyYumkGCHPWc+4r4NqZG6IFOCg0z2Nd7oqXdpL88td6UsveBDz/dz8 gxLsbPLhYe97xEg== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomi Valkeinen , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Laurent Pinchart Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add a helper function, dispc_is_idle(), which returns whether the DSS is idle (i.e. is any video port enabled). For now we add a call to it in the suspend and resume callbacks, and print a warning if in either place the DSS is not idle. In the future this can be used to detect if the bootloader had enabled the DSS, and the driver can act on that. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/tidss/tidss_dispc.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/tidss/tidss_dispc.c b/drivers/gpu/drm/tidss/tidss_dispc.c index 13db062892e3..a527c28c8833 100644 --- a/drivers/gpu/drm/tidss/tidss_dispc.c +++ b/drivers/gpu/drm/tidss/tidss_dispc.c @@ -2603,10 +2603,18 @@ void dispc_vp_setup(struct dispc_device *dispc, u32 hw_videoport, dispc_vp_set_color_mgmt(dispc, hw_videoport, state, newmodeset); } +static bool dispc_is_idle(struct dispc_device *dispc) +{ + return REG_GET(dispc, DSS_SYSSTATUS, 9, 9); +} + int dispc_runtime_suspend(struct dispc_device *dispc) { dev_dbg(dispc->dev, "suspend\n"); + if (!dispc_is_idle(dispc)) + dev_warn(dispc->dev, "Bad HW state: DSS not idle when suspending"); + dispc->is_enabled = false; clk_disable_unprepare(dispc->fclk); @@ -2620,6 +2628,9 @@ int dispc_runtime_resume(struct dispc_device *dispc) clk_prepare_enable(dispc->fclk); + if (!dispc_is_idle(dispc)) + dev_warn(dispc->dev, "Bad HW state: DSS not idle when resuming"); + if (REG_GET(dispc, DSS_SYSSTATUS, 0, 0) == 0) dev_warn(dispc->dev, "DSS FUNC RESET not done!\n"); From patchwork Wed Nov 1 09:17:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13442654 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 77952C001B5 for ; Wed, 1 Nov 2023 09:18:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7911B10E671; Wed, 1 Nov 2023 09:18:44 +0000 (UTC) Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6EB0D10E00C for ; Wed, 1 Nov 2023 09:18:42 +0000 (UTC) Received: from [127.0.1.1] (91-158-149-209.elisa-laajakaista.fi [91.158.149.209]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 40B541BCF; Wed, 1 Nov 2023 10:18:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1698830304; bh=3IFzGY8oeGtxO2wTPUesFMIUoPVmmi/6+htUtk+hmMU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=bxicC3Jq2ObCiLXFkkxIaCrLYIoMnPswexqgEjg8SUjH7lVGl94HZEavlfrxBUsdZ wz8Cmze3bRQvAtn1SOknfy4OhnadRb9dbc8FGdnlMyEhjchlBsjsFpLPul5pL3qwbw aRhtwaOP8nv0k3xnjSiLc++WwwpNriZreTA3GOl8= From: Tomi Valkeinen Date: Wed, 01 Nov 2023 11:17:46 +0200 Subject: [PATCH 09/10] drm/tidss: IRQ code cleanup MIME-Version: 1.0 Message-Id: <20231101-tidss-probe-v1-9-45149e0f9415@ideasonboard.com> References: <20231101-tidss-probe-v1-0-45149e0f9415@ideasonboard.com> In-Reply-To: <20231101-tidss-probe-v1-0-45149e0f9415@ideasonboard.com> To: Aradhya Bhatia , Devarsh Thakkar , Jyri Sarha , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=3782; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=3IFzGY8oeGtxO2wTPUesFMIUoPVmmi/6+htUtk+hmMU=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBlQhfosECtSzzwvEaTrWTML4kgj007cpTx8f/P/ TAbV/DRdCuJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZUIX6AAKCRD6PaqMvJYe 9YocD/9tLemVTGiztuTbwCBaz1BWvl38Jfz8WJagRPJmto7sGPyNo9UqO/uxA2zhR/Yjq89IAYJ XooT8GZcZZ27w3VffTDbh23HNCqbZeBssaosJffxqs9PzUEvedQHTyOHs5YUTNSBoUGtcE+GEel p5+EIBvsXiLM9Xy91k6T5Z0Im/X5BsL/VNdTQjPx50Sx8KTnNeJeM7b5cyQH8yflC19ubvi7mJy SYEvzQRcrqGNdYwlg3lpsCZcEeITXRtRiWtbNwp4spud3GlCOppzUf8UG6kpHg0/T0HNf33/FI5 6UaBC0J7TVH2ieI7ESv27SXm5nnSqjkalnbyOD2iLWgkL60TI1dQfboUUlEuUOsCYDkbqnWonvQ kK1XgdplucnltZSGxq/+tN/etgxJUjAlu9u322dc5VT2h7uow6G33qzp0LWdt7MaB3iJYThW73l eY7OhelAM/1p/T7dcy4zE7ajHDCrJUXCuh7z/4kqdWtVHZMrkiPL7hiUpA10g8Hu2+ShJtjtGfo 6mFt28u1GRH1LPFODkjOvIazVGUANFA2J6rHIkL3fYoFPvNPAtuqJefB546y5SDXPXZv9iEA4kh aLi5VYr09/Xmb2HOT9M4EosYph0kPv6N5rnWVkVm4X7oOYR2XVGvmeUJLU7zHdmgBeqdmPQVQjh 3LMoGQ1pZh7u4vQ== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomi Valkeinen , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Laurent Pinchart Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The IRQ setup code is overly complex. All we really need to do is initialize the related fields in struct tidss_device, and request the IRQ. We can drop all the HW accesses, as they are pointless: the driver will set the IRQs correctly when it needs any of the IRQs, and at probe time we have done a reset, so we know that all the IRQs are masked by default in the hardware. Thus we can combine the tidss_irq_preinstall() and tidss_irq_postinstall() into the tidss_irq_install() function, drop the HW accesses, and drop the use of spinlock, as this is done at init time and there can be no races. We can also drop the HW access from the tidss_irq_uninstall(), as the driver will anyway disable and suspend the hardware at remove time. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/tidss/tidss_drv.c | 2 ++ drivers/gpu/drm/tidss/tidss_irq.c | 54 ++++++--------------------------------- 2 files changed, 10 insertions(+), 46 deletions(-) diff --git a/drivers/gpu/drm/tidss/tidss_drv.c b/drivers/gpu/drm/tidss/tidss_drv.c index 64914331715a..37693f30d98b 100644 --- a/drivers/gpu/drm/tidss/tidss_drv.c +++ b/drivers/gpu/drm/tidss/tidss_drv.c @@ -138,6 +138,8 @@ static int tidss_probe(struct platform_device *pdev) platform_set_drvdata(pdev, tidss); + spin_lock_init(&tidss->wait_lock); + ret = dispc_init(tidss); if (ret) { dev_err(dev, "failed to initialize dispc: %d\n", ret); diff --git a/drivers/gpu/drm/tidss/tidss_irq.c b/drivers/gpu/drm/tidss/tidss_irq.c index 0c681c7600bc..604334ef526a 100644 --- a/drivers/gpu/drm/tidss/tidss_irq.c +++ b/drivers/gpu/drm/tidss/tidss_irq.c @@ -93,33 +93,21 @@ void tidss_irq_resume(struct tidss_device *tidss) spin_unlock_irqrestore(&tidss->wait_lock, flags); } -static void tidss_irq_preinstall(struct drm_device *ddev) -{ - struct tidss_device *tidss = to_tidss(ddev); - - spin_lock_init(&tidss->wait_lock); - - tidss_runtime_get(tidss); - - dispc_set_irqenable(tidss->dispc, 0); - dispc_read_and_clear_irqstatus(tidss->dispc); - - tidss_runtime_put(tidss); -} - -static void tidss_irq_postinstall(struct drm_device *ddev) +int tidss_irq_install(struct drm_device *ddev, unsigned int irq) { struct tidss_device *tidss = to_tidss(ddev); - unsigned long flags; - unsigned int i; + int ret; - tidss_runtime_get(tidss); + if (irq == IRQ_NOTCONNECTED) + return -ENOTCONN; - spin_lock_irqsave(&tidss->wait_lock, flags); + ret = request_irq(irq, tidss_irq_handler, 0, ddev->driver->name, ddev); + if (ret) + return ret; tidss->irq_mask = DSS_IRQ_DEVICE_OCP_ERR; - for (i = 0; i < tidss->num_crtcs; ++i) { + for (unsigned int i = 0; i < tidss->num_crtcs; ++i) { struct tidss_crtc *tcrtc = to_tidss_crtc(tidss->crtcs[i]); tidss->irq_mask |= DSS_IRQ_VP_SYNC_LOST(tcrtc->hw_videoport); @@ -127,28 +115,6 @@ static void tidss_irq_postinstall(struct drm_device *ddev) tidss->irq_mask |= DSS_IRQ_VP_FRAME_DONE(tcrtc->hw_videoport); } - tidss_irq_update(tidss); - - spin_unlock_irqrestore(&tidss->wait_lock, flags); - - tidss_runtime_put(tidss); -} - -int tidss_irq_install(struct drm_device *ddev, unsigned int irq) -{ - int ret; - - if (irq == IRQ_NOTCONNECTED) - return -ENOTCONN; - - tidss_irq_preinstall(ddev); - - ret = request_irq(irq, tidss_irq_handler, 0, ddev->driver->name, ddev); - if (ret) - return ret; - - tidss_irq_postinstall(ddev); - return 0; } @@ -156,9 +122,5 @@ void tidss_irq_uninstall(struct drm_device *ddev) { struct tidss_device *tidss = to_tidss(ddev); - tidss_runtime_get(tidss); - dispc_set_irqenable(tidss->dispc, 0); - tidss_runtime_put(tidss); - free_irq(tidss->irq, ddev); } From patchwork Wed Nov 1 09:17:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13442657 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A9378C4167D for ; Wed, 1 Nov 2023 09:19:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C430710E67C; Wed, 1 Nov 2023 09:18:45 +0000 (UTC) Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3D8D010E66E for ; Wed, 1 Nov 2023 09:18:43 +0000 (UTC) Received: from [127.0.1.1] (91-158-149-209.elisa-laajakaista.fi [91.158.149.209]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 0F6751C1D; Wed, 1 Nov 2023 10:18:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1698830305; bh=OSH8ynuiJ2YVkYrZuWQq2MVjAg+Zul2OXF3bZ5EaKoY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=dAbxEauTggKPBtvsLnTgVxvWaN51QrLuJNaTEEl3DVqw9QseUa8JBoFOKtKTJk4/B NKF+dbkFvR5sgddorjc/PJjo2yisNgv9W6fG56YeAYj6n7PuYRVrtOlFu5h4Yxx5pi wxL8hRRQqvGLAQlysHgUcHB6eIeSXf6GslDZexQ0= From: Tomi Valkeinen Date: Wed, 01 Nov 2023 11:17:47 +0200 Subject: [PATCH 10/10] drm/tidss: Fix atomic_flush check MIME-Version: 1.0 Message-Id: <20231101-tidss-probe-v1-10-45149e0f9415@ideasonboard.com> References: <20231101-tidss-probe-v1-0-45149e0f9415@ideasonboard.com> In-Reply-To: <20231101-tidss-probe-v1-0-45149e0f9415@ideasonboard.com> To: Aradhya Bhatia , Devarsh Thakkar , Jyri Sarha , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=1701; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=OSH8ynuiJ2YVkYrZuWQq2MVjAg+Zul2OXF3bZ5EaKoY=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBlQhfowmaSVl6BO4E/HgJrUUSCbYheTzOdaTI7j cPYBH4VqoyJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZUIX6AAKCRD6PaqMvJYe 9eIYEACPcoPMlIy8n0o9G8hXcsLaHmiclB9/T6IHAxb7QlmvPnQG5uC4ENthjLwTslHTcm9AKI3 cZ9lB9izizrFbL0x/lKcOPbFBScAOw1ADcOXo/4ECGzcCcZaFXMSmR0lJkd4INJ9PGnCIR9Bb99 R55+b+J0BFFDqBd1GEMjWlrRHp7kZWFsNEm5eZgOcbSiX52yQwzF2+kam2CjGIeZ5vnuxS0wB6g YEm972d2h9Ffn728GLcoqlRb/r5wQmWVeHecmiKLkEmUKZOUzScS3s0XmtrfCAi64iDazfjT5/r F1JGSOsp6PWWoreiAhrDb77x4Y0K1B/2NAeIYeMcI8RzZw1hnnch8Il8D1pLjO9bqsbCN2WVDO+ bf7Q0zjCCv4Xlo2/6SP+bPr15R+VZWfjDne8l22OtOc/cFXUMjh4utEtuDAu5AGWgFEJyf5oi8I DGPku/a64Y9TmVtYTrvK7EWrk7tD2XU0piwij6GK1sidpzk1F4mysb0O6xVl4GfIk6S5k515MrS ws599EtVW10LYkxigCxnBtQcETXPA1tePRLPE/oBDJHgOVBw/adQ09KpmomET4rplN7FhSCGMjM CHraJxTbEKvPg9JdknRS1e2MTspW5EtMUvERx/b9S0ONGSLaw1AP0sNTAcFamjFSOvAQBouPhb9 ztjKjvBih4QbYmQ== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomi Valkeinen , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Laurent Pinchart Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" tidss_crtc_atomic_flush() checks if the crtc is enabled, and if not, returns immediately as there's no reason to do any register changes. However, the code checks for 'crtc->state->enable', which does not reflect the actual HW state. We should instead look at the 'crtc->state->active' flag. This causes the tidss_crtc_atomic_flush() to proceed with the flush even if the active state is false, which then causes us to hit the WARN_ON(!crtc->state->event) check. Fix this by checking the active flag, and while at it, fix the related debug print which had "active" and "needs modeset" wrong way. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/tidss/tidss_crtc.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/tidss/tidss_crtc.c b/drivers/gpu/drm/tidss/tidss_crtc.c index 5e5e466f35d1..4c7009a5d643 100644 --- a/drivers/gpu/drm/tidss/tidss_crtc.c +++ b/drivers/gpu/drm/tidss/tidss_crtc.c @@ -169,13 +169,12 @@ static void tidss_crtc_atomic_flush(struct drm_crtc *crtc, struct tidss_device *tidss = to_tidss(ddev); unsigned long flags; - dev_dbg(ddev->dev, - "%s: %s enabled %d, needs modeset %d, event %p\n", __func__, - crtc->name, drm_atomic_crtc_needs_modeset(crtc->state), - crtc->state->enable, crtc->state->event); + dev_dbg(ddev->dev, "%s: %s active %d, needs modeset %d, event %p\n", + __func__, crtc->name, crtc->state->active, + drm_atomic_crtc_needs_modeset(crtc->state), crtc->state->event); /* There is nothing to do if CRTC is not going to be enabled. */ - if (!crtc->state->enable) + if (!crtc->state->active) return; /*