From patchwork Thu Nov 9 07:37:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13450694 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 A031AC4332F for ; Thu, 9 Nov 2023 07:38:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9C3B310E1C7; Thu, 9 Nov 2023 07:38:50 +0000 (UTC) Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8006310E1C7 for ; Thu, 9 Nov 2023 07:38:45 +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 DE89AAF2; Thu, 9 Nov 2023 08:38:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1699515501; bh=4QrpN0remY7a+J6VizLfc7b4s63ZI1p2RwGVH+9cdlM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=j6xyRaDMQbKBte9nBDiQPWjV74ioRWP+2nYnkXnh0FyrLDk6z5Dwt1H8FkwhS5UDh 4vuENT8g05YNbMb+USR045s6/6vr/A9NVr7u6+tGweleGYMqw/NIQvilVmITgslWmb ALH+6g51eyeS0rhTxZhLU3yJiqM4FWRH8abF+GKo= From: Tomi Valkeinen Date: Thu, 09 Nov 2023 09:37:54 +0200 Subject: [PATCH v2 01/11] drm/tidss: Use pm_runtime_resume_and_get() MIME-Version: 1.0 Message-Id: <20231109-tidss-probe-v2-1-ac91b5ea35c0@ideasonboard.com> References: <20231109-tidss-probe-v2-0-ac91b5ea35c0@ideasonboard.com> In-Reply-To: <20231109-tidss-probe-v2-0-ac91b5ea35c0@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=972; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=4QrpN0remY7a+J6VizLfc7b4s63ZI1p2RwGVH+9cdlM=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBlTIx9R3Be7juvu3cbDA4igiN84v7BvPT0aVvXJ zJeuTmjDzGJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZUyMfQAKCRD6PaqMvJYe 9SCJEACbeJnBxXR6wHkmfYPIYYjCWXulM6Bgr1xIQQcuZqr9vzIk86dR6KFM0z7rReRsDtdluOz EXtzLew+5jM9R9JvwI5DU/uZrmseigA4DZRkIFQolWs5mJGVFdgCIO/ImVhw6yIBl3DhirYxuXr mG+oCx2v/frd5X9ImjvfVZ+M8thl+7Lti5rePnMIDtGue4nx2Lc/LqA3FxsKLxQOTznbtVFMYSJ OmZofiG2kBjrJ3Inniym+UZryapoVvOr8OSuU6ZIvX2oJMQV32Sk34jQIQ6ULPj86rgUKJKaCZ+ UAxE/j8h9Izf0RkHsLFJlF4wGzWLHicWgySc1YVSnZPvPAPfuZASgWuNmcWlNxIdNxf7AXlaMUy mCvA9qbYtRwyES8B8cQ6PNnzmcKkGM2ppr6pzSmkVJIgQCxbSrMXpk8fD+RTDjAYXqAevuII7MC /x46ucTVzxQwf5e/nrHgX88hrcROe0aC0gor33ZSTOrScGdC9KJSDV4M9ebhpgYDtyX/gmJO9Ud pHXlftVl8yspfdjbn8oUTUYkSXsGZIRTCWROHD77upuxNoAgdfskSQWxQi8FsHgiGTaT4utINXa 1iVTusW5wGQkLyikemMAO9/TQaF9yjasglOh71knN/vRpOggltHZ9KAVp5cKLtArlINTZSzucHC Cks8sZJRK+20Pgw== 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 , Francesco Dolcini , 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. Reviewed-by: Laurent Pinchart Signed-off-by: Tomi Valkeinen --- 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 Thu Nov 9 07:37:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13450695 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 3080AC4167B for ; Thu, 9 Nov 2023 07:38:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4B81510E1C4; Thu, 9 Nov 2023 07:38:51 +0000 (UTC) Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7E85310E1C4 for ; Thu, 9 Nov 2023 07:38:45 +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 BA643E0C; Thu, 9 Nov 2023 08:38:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1699515502; bh=xt5MBUgnI/jgAIonK42bagqQqpKSKcbUYBa+PmKHG8E=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=sajfIXcHt8KHj1UJYdggbsMVkUc6GHdsfbn+OLXb9IHJBnAWQVnY6PaJLtcpqKlEG 47lGzk9Hc5c4naZLFuOvXLQNqEfUHHeJm+V77Ae2ex8xhUY8BMzyex+sgAEBrAXt1E tkDEo8g7o1jEhD472nfGt8vg9um6lrTQkb0FZdyU= From: Tomi Valkeinen Date: Thu, 09 Nov 2023 09:37:55 +0200 Subject: [PATCH v2 02/11] drm/tidss: Use PM autosuspend MIME-Version: 1.0 Message-Id: <20231109-tidss-probe-v2-2-ac91b5ea35c0@ideasonboard.com> References: <20231109-tidss-probe-v2-0-ac91b5ea35c0@ideasonboard.com> In-Reply-To: <20231109-tidss-probe-v2-0-ac91b5ea35c0@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=1731; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=xt5MBUgnI/jgAIonK42bagqQqpKSKcbUYBa+PmKHG8E=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBlTIx+fN+ubO5HJG9gxPYBA5D9PTIkfRNffzkxn gQ0MtheLoeJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZUyMfgAKCRD6PaqMvJYe 9f5lD/97VxLqRK0F2PM6yui/5XVHYoti9Upp/CtctMV6KxkJ3rdFISUaPcTNRa6PRxwl1PKqZT0 8NO9huwa0ImfdO4dINDszCfjKOzDl1UpnEpW5zfymJWrBd2dy2Bx5OUdG65UxhVzL0MZ7G0/j57 PR0gocj56G/msXDxhTxars+m8ZY5C9LzM6UZftzETmNoGDJgbz1QhTbj3ne6EkUV8ThJmpxFmkU hBctuObo/1j6qYrBBODTfjb9iStzmkvRgh88psTUzHqe+C6jpZ039HGrTYM5iSrhazWXeV3B5ad ndJctMhkjh6e0sRLozWFxDUzdCC4NdpAk05T6+s/A9ZueVBdyPA1BTdGi1h4WL83zlswLNjoG66 lqPLRlmqkr0r2JJho16EHb4kk12ietXWyIh0oadAmDCwZnyk5OZOgkglwArGTV7/To3wL0RRthg tzgUpOxSVjttychgvCunCnfyFeRwM/YTBZEyk7LpNkajGkxT10sDlaX6Hpi6nNPIOHlVXverLM2 9Zfs7sS7FVG/modDQYXZjsBRPbEtW6zOsk9igZFVKscbVEO4V0W/OVMfIwyAChY8YZ2vnYB/FaO GmWAtAJBZ+G3LGjYRktzVuYLRDTd6HazMu5dTIKpv47RJEloY4nsVqzTaJjqEWYFTsFK/9aUOX2 +1NBEbm4t0KWDqg== 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 , Francesco Dolcini , 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 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/tidss/tidss_drv.c b/drivers/gpu/drm/tidss/tidss_drv.c index f403db11b846..f51c87e26e10 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); @@ -192,6 +197,7 @@ static int tidss_probe(struct platform_device *pdev) #ifndef CONFIG_PM dispc_runtime_suspend(tidss->dispc); #endif + pm_runtime_dont_use_autosuspend(dev); pm_runtime_disable(dev); return ret; @@ -215,6 +221,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 Thu Nov 9 07:37:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13450696 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 DA795C4167B for ; Thu, 9 Nov 2023 07:38:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0C3EF10E1C5; Thu, 9 Nov 2023 07:38:58 +0000 (UTC) Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 805D310E1C8 for ; Thu, 9 Nov 2023 07:38:46 +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 954A716F9; Thu, 9 Nov 2023 08:38:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1699515503; bh=ADSCf/9TIbVJ44AQQj3UfUMyJW9l+hCXhR2JJRI/apQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=tO1y8Hgu+dyzO0pbinNg/Jk7Uj7+U/jI8pf+9GoCTU2LcQsd6R1rGS9wk+oAofMxf Qqnf0JjyXhSrazYwCdY/1W7bC/UtnA7rp5PQR+GYUv+C3F8JgzxviI7V7ibfKlQ7lF +eWqHJOLl/b6U3h/o3ltf7/fqbhVxKG2ol7RaZ6Y= From: Tomi Valkeinen Date: Thu, 09 Nov 2023 09:37:56 +0200 Subject: [PATCH v2 03/11] drm/tidss: Drop useless variable init MIME-Version: 1.0 Message-Id: <20231109-tidss-probe-v2-3-ac91b5ea35c0@ideasonboard.com> References: <20231109-tidss-probe-v2-0-ac91b5ea35c0@ideasonboard.com> In-Reply-To: <20231109-tidss-probe-v2-0-ac91b5ea35c0@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=775; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=ADSCf/9TIbVJ44AQQj3UfUMyJW9l+hCXhR2JJRI/apQ=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBlTIx+iCOBgA7JX7ZXqNP8KfAUvhOyV2T+GXVa3 HZFYkogZKuJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZUyMfgAKCRD6PaqMvJYe 9aWDD/4vUmxETtGkP4RQBQVk+uVqsAIvqnNIP4L5Royrq09Im4G6XywVcoDKU6tD4cUGkTIIvxA IgHw8S5K6L3Dd5VVEx7TDxi8UABWFCNyO7P6PDdGFWBo7UotCPQ4v/DvYOtA21Hvz8F2fy7z+Nr //mNQHLLt7MqrRgxwJGWuqHqjcpNFW3aQUkt8bViQFGrDeaga/nqx8VrJKOGVmKGq5bxoOn7GQW k+mQ39XaleSByZK//7hDdnQG6qirWHFAGOGZSS7ihw4J4FFy3xTUvE5SXKcdMPIqr3zPWo3o4sW IikqGQE7HPtVM8lHNcMNpn8NuhxIidg+BaGOi6b86pPvoq6sEiQoFvL0EXzngsr3kcFNzecxq9m RZhj1Uh2RKBgb0kKekUHOIQNl1X2XIOpblFQleo+IeZDZBVPXw3jQQHuCl5RKvbrUjY37UxNjdp ldTp2B52ITTcZcFolpa2+hUWP46cD4agoIKVUMh6UXQ5DqsujDBOL71mu2eIQcyMB/dJbYX4+2O OPrVjqxEPzzTEYMSfVtlR75ioTIKcv17sRMXfJuvQvw1RxM6nm4vK30cKEpsc2DFQTigw9RkMKH RjLxwkToQL5U1V1TsRpXnILN3srdKlC2cM6DPY+Z+EOKPFrd1pmkoFIPYbli4N2fPfN2oN1WbJD pi+iLY6qUoq00uw== 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 , Francesco Dolcini , 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(). Reviewed-by: Laurent Pinchart Signed-off-by: Tomi Valkeinen --- 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 Thu Nov 9 07:37:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13450697 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 78C9CC4332F for ; Thu, 9 Nov 2023 07:39:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E236A10E1C6; Thu, 9 Nov 2023 07:38:58 +0000 (UTC) Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 617D510E1CA for ; Thu, 9 Nov 2023 07:38:47 +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 73C6817E1; Thu, 9 Nov 2023 08:38:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1699515504; bh=1GEKCab8OHb1x6cabABKC9MQy0dJhOUkvWfwR9SFuWU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=lx6pfWLVWCmmHaDeuOyAaaC57VoXbIEoLYr8BDw0U3KVHnD1/6LHIjN3OmgxMMDSC y8iBt0vYIfWg4drQZrTcC3RWuVpOtBqbktQzQn4jsd6KIdv7OfNVRXwdqCJdvJwgCC 6ZE7wRaJ2kbVaQos1sdat+2e81zFgtOS0JcgF+RY= From: Tomi Valkeinen Date: Thu, 09 Nov 2023 09:37:57 +0200 Subject: [PATCH v2 04/11] drm/tidss: Move reset to the end of dispc_init() MIME-Version: 1.0 Message-Id: <20231109-tidss-probe-v2-4-ac91b5ea35c0@ideasonboard.com> References: <20231109-tidss-probe-v2-0-ac91b5ea35c0@ideasonboard.com> In-Reply-To: <20231109-tidss-probe-v2-0-ac91b5ea35c0@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=1539; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=1GEKCab8OHb1x6cabABKC9MQy0dJhOUkvWfwR9SFuWU=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBlTIx+bzzkLDQBAuaUOAtJiZaksLTxdF5B9rdMq LxobCQK80CJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZUyMfgAKCRD6PaqMvJYe 9Rc8EACWQUnArZGNglO1/TEwH5VQgmaOPDpDdNQFrSWbEXfHEH5Mhxdb/yzQJAryQqHswgWONS8 zv/voBbUvNC+gHdYUL8s2VywJMRhGhpkrcraLdTCuXb/Y1Zq3W3uAH5rRvUT3JR7tNqkTXbcLVq aYLwe/Vt2ADLLrAqRjOPlh8gx1zQdobVUTpJaRVOG0b5+gjSpbaPlyJYmK5uhigtRkHzRGpC8e1 3nAnCQV8nK0EHAWEIpe+k1MKvSiqPR2vayBxmgmZzodzdjX/QQ5VdjEA13dOflDg7+RS13TDGbG F0Cm0oEZtmZotu7pZvDPPFml7byp3c1jMaEBYMoxTS4IVSPnf9GyhC1vwxM2yKymnKJ4qLuJZvv k7oKCpe/vDSUnEfPzcet1AYNoqBgHQccBJtkKpIN3BErRBnlZKECPH5HL8Wac2ccYxjnObxupe0 1+/yYW5coIxn0sctpwoAX0PcX20xxo32ctL0CSB51sIhfmT7S6d4bzRNFE+b41pUnTA6n+Cih41 CVJEULzPTsVu5NdAdyA+9prHk7TrCK2Sg2ZwlsvO4qnH2doDpe5yYCZXIUxgwfU9HY5ZMRnoDOe Mi206BOCbn0vLkHOm1cRtOUlCYkmqtyihGi756/uR1CKq80fzIFYjNiPaiLYseHyu00ThJaOfFK 0Op0KFDTJ2N6p6A== 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 , Francesco Dolcini , 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. Reviewed-by: Laurent Pinchart Signed-off-by: Tomi Valkeinen --- 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..deb665d0ede8 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; @@ -2829,6 +2825,10 @@ int dispc_init(struct tidss_device *tidss) of_property_read_u32(dispc->dev->of_node, "max-memory-bandwidth", &dispc->memory_bandwidth_limit); + /* K2G display controller does not support soft reset */ + if (feat->subrev != DISPC_K2G) + dispc_softreset(dispc); + tidss->dispc = dispc; return 0; From patchwork Thu Nov 9 07:37:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13450705 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 2B1ACC4332F for ; Thu, 9 Nov 2023 07:39:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B1DAB10E1D1; Thu, 9 Nov 2023 07:39:22 +0000 (UTC) Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id E3E2710E1CC for ; Thu, 9 Nov 2023 07:38:48 +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 546FA192B; Thu, 9 Nov 2023 08:38:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1699515505; bh=VZv+V3IKNcMeqSjrqpYywcyKWHFI9nt7knJQOXJX0vM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=qjxCD+ceAFZq3LYouJotO30GncXvPdnTefzEuEgBDOqHtKVVB+RZgA//m9RKzs2HY FOeWZfBz1kEhwD+5j3z/E49QGoId+fmqGJNWo1OY4V7Ck9VpkACnAQz2NyI6S1wOVR OaX/XlB6S7XUBtX1WDV5/VY+zJ3iuTE4uKB2KCns= From: Tomi Valkeinen Date: Thu, 09 Nov 2023 09:37:58 +0200 Subject: [PATCH v2 05/11] drm/tidss: Return error value from from softreset MIME-Version: 1.0 Message-Id: <20231109-tidss-probe-v2-5-ac91b5ea35c0@ideasonboard.com> References: <20231109-tidss-probe-v2-0-ac91b5ea35c0@ideasonboard.com> In-Reply-To: <20231109-tidss-probe-v2-0-ac91b5ea35c0@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=1539; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=VZv+V3IKNcMeqSjrqpYywcyKWHFI9nt7knJQOXJX0vM=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBlTIx/FF6QxSHj8qkvS1orhbruRNq/l+uSonfZ4 /D5S5+WMyuJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZUyMfwAKCRD6PaqMvJYe 9VKrEACnZABVQDSXZM2HMY8KEoDduklNACb3sB5wbNqXx6yhXF6Bfz8V0vXm/3WbnM/uj6Tf0is SkrFyj3F2oNfDrPUOcfRHyfKXg+4j8CDyvT4/ZEzkGeqTT6ZGGlix1sfmTaeWExckRGkaeDXmDc EtA1RTzyMdvaDZlf+iNff4B/tM4BhaE/QnL3zTPpmZhH0A8Vfim/ujER+PkSCQ9tYBMmL4Gz94R i2n0ZaJRIJsqTgKEPH8GQ7mHauo/bZfFyO2akOGfqhPi/e8mzkLSfTOEImKyuDHYNDgBhUCjsX+ /ZuY57fGqk9F5F5WQtGGXiAS6CsD0rhCHzGdoA3rbgF0wXsFKFm/drOPiimrgUsuZxfixi6RQHP cNn+RqTm2R9vJCYESteB95Lv1634KsLUs5jmcMUgscfTBSXezRTfqHA8fkzmRPPdkyjpBH4qhjh 3wEj0eHCFJbxd1vgUZNEcKZvNfYChkRJaft6PQeN1rI7yzdn4/ng4PWUfF/UIhjfCgLJd10Ac0n Muwt47+7rRL/ZaJVXICXQFha3/+O0DWfmlwahE8aKlhvDC0x2CFEHH3aTr7m9FjAAKuqgsi2tsT d1YCwr1a+Hj5cZR+/hiuLJk1MbSnx+go7uGYXIUaTqA5wiy0Xx+Y1ezj82iic7ERIAqm6I/LgVS 2uvjhCVpj1JzUNQ== 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 , Francesco Dolcini , 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 deb665d0ede8..50b475b285d9 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) @@ -2826,8 +2830,11 @@ int dispc_init(struct tidss_device *tidss) &dispc->memory_bandwidth_limit); /* 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; + } tidss->dispc = dispc; From patchwork Thu Nov 9 07:37:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13450698 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 50063C4167B for ; Thu, 9 Nov 2023 07:39:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4DBA910E1C8; Thu, 9 Nov 2023 07:38:59 +0000 (UTC) Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id E432110E1CD for ; Thu, 9 Nov 2023 07:38:48 +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 329FF1B44; Thu, 9 Nov 2023 08:38:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1699515505; bh=ea9sAgDoBLxTb7N3GvFQ0oKnHf7196fJPgOxmwvSZWc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=hLtHiFr71+P5vgrZ+dKQf7om6zS0BgGAJQVg9fK3rq1E4HvoTsJTnmRl3qL0TBtHP E2nTZlx12cWoAHnfLpELkmpUtVlXSVypPbWH63rOxsesdUion/OIfwPLMndqK+IyvY a+tsPd2pDcVigeq7xdjQ9dLSUoaZrnM/2xZviThg= From: Tomi Valkeinen Date: Thu, 09 Nov 2023 09:37:59 +0200 Subject: [PATCH v2 06/11] drm/tidss: Check for K2G in in dispc_softreset() MIME-Version: 1.0 Message-Id: <20231109-tidss-probe-v2-6-ac91b5ea35c0@ideasonboard.com> References: <20231109-tidss-probe-v2-0-ac91b5ea35c0@ideasonboard.com> In-Reply-To: <20231109-tidss-probe-v2-0-ac91b5ea35c0@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=1429; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=ea9sAgDoBLxTb7N3GvFQ0oKnHf7196fJPgOxmwvSZWc=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBlTIx/zx8GTBnJK+j6YOO7FS+lZfIy9XVNj7BaH 60HV9E1MpiJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZUyMfwAKCRD6PaqMvJYe 9aoGEACKfzf+D8s4b0/ya3e1Ml+zOzyDtczeaI4kg4X8rD+yP5JMDDWJijlclGiJd57H5JiFhMH qTJkKVMU0HnA7TtYx6DZlJai9nAH6hcn6IxPk8+LWiDlYe0DbBlT/yl2C2FufIsc+q5X1Fn6O0a An/+loDGcSk+8z9fiDa/AiwwUlK0UxLNguhhheHAFRdBNHiIjvtZTrjji6uqwoQu67H+vgx9OTm C2Y1anUYygx4spYEMezC5rpm784DvRF5FEVBqsauHu4mikOO+c2gl6fXt/4Lfm+ht1S/WT6becM VZoTq4IqqW2tDJqlBbn7gtXOx+NvPxFJ+ja03OI2Ta96J0xaJ2zrVxaj19HYSJOSuUMlZVSSgxR UB5EszdFK+e12/P1mfZc8VrqPJu+SwCwYX6wnGGHUgLNgKUmtWh0HDoI5JlicXNlbS0sooEpDaR qrclD2NJ+tM8dzBcNvX28VqPURvUdOCboQsmZu7e72+Eg2BdLJ+hExUYsRCMPxZzFnT/5DmH+6r d/zLi3aYsejHE0h2ni+Tf77eb8mAKPz4gob/rYqAICVJDLgBfK3je+exd8JhoxjnRWVUnkFVYNM 90QelrNnZphKq6ggT6b4b+56GtC/EMuWNGfRV04ixGV3WkWLCNWf1HbP9uY7+onoIKdtPu/EH/W FM2bYzO6C+3GDBg== 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 , Francesco Dolcini , 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. Reviewed-by: Laurent Pinchart Signed-off-by: Tomi Valkeinen --- 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 50b475b285d9..c82fd5bc9be4 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 */ @@ -2829,12 +2833,9 @@ int dispc_init(struct tidss_device *tidss) of_property_read_u32(dispc->dev->of_node, "max-memory-bandwidth", &dispc->memory_bandwidth_limit); - /* 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; tidss->dispc = dispc; From patchwork Thu Nov 9 07:38:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13450699 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 3C5A6C4332F for ; Thu, 9 Nov 2023 07:39:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3877A10E1CB; Thu, 9 Nov 2023 07:39:01 +0000 (UTC) Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id B576510E1C4 for ; Thu, 9 Nov 2023 07:38:49 +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 0D9631B87; Thu, 9 Nov 2023 08:38:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1699515506; bh=tErP6ntTDdC0gabpvQZT2twhldOSaERfSjPvzlINOYg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=kR7DvnBnuKYV6zUJN5kbkxd2PFfd4UnaU7zGCrcxZBRaCg7KC648DlNBkSvzqoz3y FOxBwhff6kCosGe2U5jZ5RCcY158Yk3tZxNcKjH0s1cCQUNyiJzBP53pKSO46Wlp6R wJaujOJ4U6gdcu/vUBhvdNrmX+82QinExMBCKIXc= From: Tomi Valkeinen Date: Thu, 09 Nov 2023 09:38:00 +0200 Subject: [PATCH v2 07/11] drm/tidss: Add simple K2G manual reset MIME-Version: 1.0 Message-Id: <20231109-tidss-probe-v2-7-ac91b5ea35c0@ideasonboard.com> References: <20231109-tidss-probe-v2-0-ac91b5ea35c0@ideasonboard.com> In-Reply-To: <20231109-tidss-probe-v2-0-ac91b5ea35c0@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=1452; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=tErP6ntTDdC0gabpvQZT2twhldOSaERfSjPvzlINOYg=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBlTIx/4yyEc0vlhu0LY6PKDBh3YAinZZWmPblHD ALXeO8ROGWJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZUyMfwAKCRD6PaqMvJYe 9f/lD/46bgpdv2S8ITGIdgfaPkwqsjWoOoC0LAxXSonc5kSzdeRIvr9b3YSLkZGj3SwbZ7M0oa+ oHtFqztyD/dYGNcQxIdq47NawuCcZjIC0Oxg9owTgfdSPLvJX5sMC/UolVmF9KroPSo/BO9Fh1i E4REh0S0d1gvKwRL7Bt9CG4QYvzS/biPAml1S62EUDUalTWU3y1WYGrUbgjdps/HdGpjFHdPIv9 eWv+etZe9dRkUDBVkx5pLkgT6tEp6X95wurcYPfticPLbvTc70CYepSF2yAgpOH3XgBEy7h7aNh 3Sk7ZDOsVoYavoI04mQdKguVSdvLFm2fXlpVsq5IMtwy/exdpZLVGFtIxKlJezYv1WHlQvdwKoL vLYHMfz5RIJWuv0ebSZ2vGmG7rRUXcG+jFilL2P3HVN5PRYtT47fzeWMeeRgv9mOJAAMJTFjuKE ViCUFvElQyiaaTC35VSQclLM/dvv5mLF9QftiYqbOopX00vWwa/HPCVurQ+rDtAdWcL3N2/M1h3 +GbWNqcX9MhFm9JTN632CxUZ2GDxTyRCrgziQK5QCMhMMwWiuLvQPXlxBP/25daaG7JAtUpZvVG fbEOnJEc7sCWzqk0qGutAEGJD1SSW4Takmxye3xd2rlq/iwp0eI9v60xmiwTn9P4I9KoKIUQwC1 K44aOqsEWDdAF8A== 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 , Francesco Dolcini , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Laurent Pinchart Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" K2G display controller does not support soft reset, but we can do the most important steps manually: mask the IRQs and disable the VPs. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/tidss/tidss_dispc.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/tidss/tidss_dispc.c b/drivers/gpu/drm/tidss/tidss_dispc.c index c82fd5bc9be4..a5c0b72596e8 100644 --- a/drivers/gpu/drm/tidss/tidss_dispc.c +++ b/drivers/gpu/drm/tidss/tidss_dispc.c @@ -2702,14 +2702,28 @@ static void dispc_init_errata(struct dispc_device *dispc) } } +/* + * K2G display controller does not support soft reset, so we do a basic manual + * reset here: make sure the IRQs are masked and VPs are disabled. + */ +static void dispc_softreset_k2g(struct dispc_device *dispc) +{ + dispc_set_irqenable(dispc, 0); + dispc_read_and_clear_irqstatus(dispc); + + for (unsigned int vp_idx = 0; vp_idx < dispc->feat->num_vps; ++vp_idx) + VP_REG_FLD_MOD(dispc, vp_idx, DISPC_VP_CONTROL, 0, 0, 0); +} + 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) + if (dispc->feat->subrev == DISPC_K2G) { + dispc_softreset_k2g(dispc); return 0; + } /* Soft reset */ REG_FLD_MOD(dispc, DSS_SYSCONFIG, 1, 1, 1); From patchwork Thu Nov 9 07:38:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13450704 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 4A420C0018C for ; Thu, 9 Nov 2023 07:39:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1FA6210E1CA; Thu, 9 Nov 2023 07:39:06 +0000 (UTC) Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 947F310E1C6 for ; Thu, 9 Nov 2023 07:38:50 +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 E774E1BA7; Thu, 9 Nov 2023 08:38:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1699515507; bh=VyQFOHUX27qoYp+sEZHLrOOnAGthD9ucCI4/pfyGBgw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=BwTNgUW6HHSjGvrI/xQoVOgNcJJSymBeJ1IwQYT3VnMqE3zMJ28jh6WegKgj48+q0 bA8KGaYB2vUFhpfeBfBiaPrXrjZOuarBHjnkS/PCzE9OO5Pq4CBJW9QvmuOowoJncY FhE6xEDT05EBQTT4BnjG0rXjPtkeiEXAlg1ev4Vg= From: Tomi Valkeinen Date: Thu, 09 Nov 2023 09:38:01 +0200 Subject: [PATCH v2 08/11] drm/tidss: Fix dss reset MIME-Version: 1.0 Message-Id: <20231109-tidss-probe-v2-8-ac91b5ea35c0@ideasonboard.com> References: <20231109-tidss-probe-v2-0-ac91b5ea35c0@ideasonboard.com> In-Reply-To: <20231109-tidss-probe-v2-0-ac91b5ea35c0@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=2802; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=VyQFOHUX27qoYp+sEZHLrOOnAGthD9ucCI4/pfyGBgw=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBlTIyA7lAsXjoKndhmceZLoKWYp42ow/HZpdLXl v4dYGJXejyJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZUyMgAAKCRD6PaqMvJYe 9VK0EACmedDicf6gu2jeCVhtFxLC9E7UeAPCWk8iDpU8txnM2UKnf/2Go7QKMtArXh7urR+JczJ lPIcEj+cKoKoelW+JOkyhfKtMHFknHr+0G+yMV9G0aVG6CPrN8jXKnUyUr9Rf6j0LJGYM3svaxw gUTPMrQXlwjH510BZra9/VwGvOdYT6DZK1eBfqQwVufSrIAw//M8JDnXhuBNgLNxOIoMO//SbUH 0zQwWL7Au8mypN65+rf9hoZuvJs2D6T2nenjZ/lQ26eJcvIsWefgzWjJKq3HJUdRWdHzriIlkQD Pr4MiGGXTvMlZxmXWP/jK3sHUpFm7+IjeI40nVdZ1Jg+PrzlrhrX0TfzMJpAj3XvGg3yKfeAPFE mMHfvUwDI3UL8MxSdwtjgMSd3GjFAQX2Oe9NHY0RDAiQL/SeryP9GxHM+/+VZzcV/a5u3aschyA 645hz2iFhRKX+lom9GWv5ZVe2zHl5WBI/aw0ExkpSriVkiX+usBZzBDuSlcT3GsSC8Rh2cVKQDR TK6F5pv3ddLcvg2zoqHdiLxnovgQavANTbXML4TIpZ35iqGA0MZ/iE2XGJxWcsRsd/QuFw67m0y OLfH9hQuOOxpWdB1EMpiarxQ3CWJxY/lJKuRx2KIrYVxqGzXY1ZJvv2PqoPMDW/vEspDmy843wJ 8nEq+2DvwXOJN5Q== 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 , Francesco Dolcini , 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. Fixes: c9b2d923befd ("drm/tidss: Soft Reset DISPC on startup") 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 a5c0b72596e8..8d6ac618c539 100644 --- a/drivers/gpu/drm/tidss/tidss_dispc.c +++ b/drivers/gpu/drm/tidss/tidss_dispc.c @@ -2738,6 +2738,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; @@ -2847,7 +2890,7 @@ int dispc_init(struct tidss_device *tidss) of_property_read_u32(dispc->dev->of_node, "max-memory-bandwidth", &dispc->memory_bandwidth_limit); - r = dispc_softreset(dispc); + r = dispc_init_hw(dispc); if (r) return r; From patchwork Thu Nov 9 07:38:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13450700 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 560AFC4167B for ; Thu, 9 Nov 2023 07:39:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 51BC310E1CE; Thu, 9 Nov 2023 07:39:02 +0000 (UTC) Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7BD7510E1C8 for ; Thu, 9 Nov 2023 07:38:51 +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 C4D1DAF2; Thu, 9 Nov 2023 08:38:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1699515508; bh=DctFIvkDoFEqJ33Z6ruCYMdZFJxb/7pQYzOou//Ap3I=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Dc9GjD7/juHAmMUUFhiwOgCXA4OXdrRrZ1hX8ejF44mMI0MHKeBCDabyy6gpnwGsv zV7+IhxWEZhz/maI/drQJZZAYppVK+28umotd42BzVPPnqHeFwOLd7o8gFcHVnViF8 w0XlrVI7Beh8FITWRxveF3I6mOEOHc2W6Mt6WLbc= From: Tomi Valkeinen Date: Thu, 09 Nov 2023 09:38:02 +0200 Subject: [PATCH v2 09/11] drm/tidss: IRQ code cleanup MIME-Version: 1.0 Message-Id: <20231109-tidss-probe-v2-9-ac91b5ea35c0@ideasonboard.com> References: <20231109-tidss-probe-v2-0-ac91b5ea35c0@ideasonboard.com> In-Reply-To: <20231109-tidss-probe-v2-0-ac91b5ea35c0@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=DctFIvkDoFEqJ33Z6ruCYMdZFJxb/7pQYzOou//Ap3I=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBlTIyA/Ed2GdhSjNB0TdLDAtTBLS3T3owhC5Feg AjEZ5prDE+JAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZUyMgAAKCRD6PaqMvJYe 9bfXEACOcy1uY/FsnMlL7FZbPFWduaeQxZS35htX2N1qTBrmP6urK9VYAyugcSbuDvezOUMkNi5 dYnMaRD08OrqD6HlQLiDVOjP+DWiS0DN2JNnXctyXKrl/ozrbnPLGqdwEQcjSDYkusWqyaYP/Kk QUfzxb1KDStz9dlgI7nBBOlQY7mS0jJymZc4JlZw4IF+ZSBGvGA5xVgWUn2vb85mm/6sOCcDizn ysgYo6Bl4YwOH1LQrCIMOvtLdx2EgfpkDmkig9QteDP6r3UXwQUV3iG+X0w46kcf7wvgDYdpHhH 6k6dHcVk/BWSbWCY1k3Hy4rXRWmch85qQTnY12w4aGi5j2BfBZeAcZ3nVuRNeN026GQfvIXDh5y 0zu5lkUlg0aiH6EsXU6UQmJG/IATb/8r8gSV50VWUon+GOwDdHI6OcGGYKlUHFcWBrpOdGaeSpb orpwMgoAbzYT2gvSPS1UAtlg/bs6gq6YjyA3x1mm19wy1ux4yY7q53P+Oz9UAfqTYpGQYofn/cG XLy5u+yMAiKmIJFSpMaliWPdcRnbmCynwcIZulo8IHMq80pkSWPuR6H8O5LxTzU0OZNHUYsYHbw dvHXWuOL6B+qzOYSNEVWI9SBF4a9icPSWQ1ooKTbt7XF+5RuxOkymCUhRONJCwetNsRm/IUYAxC BxCTt++Vmnonh2w== 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 , Francesco Dolcini , 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 f51c87e26e10..490d15ed2216 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 Thu Nov 9 07:38:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13450703 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 DB246C4167B for ; Thu, 9 Nov 2023 07:39:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 919B110E1D0; Thu, 9 Nov 2023 07:39:03 +0000 (UTC) Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6327810E1CA for ; Thu, 9 Nov 2023 07:38:52 +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 A50561BB1; Thu, 9 Nov 2023 08:38:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1699515509; bh=bQWW0pZKCuRvL4IYy0nb/sJkN3i+ZB5gIxx8kN/IznA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=l0LuD9VGb7eGrWm9XEivrXjRtUJffMyYuUz8AQ6e05CYLu00NmxUHnvlSb+FQgE+y zsRrT1lF6oCv6DOcX/wzDPsJ4CED71YeadhcEuDEd0bPG2ZFIljZSqKT3LjR9ohx/J ins6WciQkLFs+8jHswhDa6gmUT0DT23Oyp+fHJWE= From: Tomi Valkeinen Date: Thu, 09 Nov 2023 09:38:03 +0200 Subject: [PATCH v2 10/11] drm/tidss: Fix atomic_flush check MIME-Version: 1.0 Message-Id: <20231109-tidss-probe-v2-10-ac91b5ea35c0@ideasonboard.com> References: <20231109-tidss-probe-v2-0-ac91b5ea35c0@ideasonboard.com> In-Reply-To: <20231109-tidss-probe-v2-0-ac91b5ea35c0@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=1862; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=bQWW0pZKCuRvL4IYy0nb/sJkN3i+ZB5gIxx8kN/IznA=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBlTIyAJ1HO4rcoZbtH19be+oc3Ci8occSFZkPT1 5g9ExgrbdSJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZUyMgAAKCRD6PaqMvJYe 9aK4D/9TZFHEorS4CIO2opcLsKveOvHzSNF7GVjMUdyC2+VwtHV9aOK9w/GH+Fg1ulHRhV0who3 wzU5oEyy03kPxpgx+6ZqG4/GOCOGCSzZecZsxxWInNhKE+PwhwUuZgZFRWf+TDN4buVb8uuzKkL HPYOUwzGzLeOK4L+6cA9nyCg7xSJf9XpEchNWbPk63ZXTdld0G72d51K6OYL5Awu8L0D0ALwrHo yHYyiv2lqSkY/jtElucHxmYqocQS2rhJ6mSCyJXOrPQkpqYyI/Jg3EtV51w7QjE+c7M3ANBdAk4 CBxPZSYB3fwR3lHjYU2XFxF64H+lR+hW9gZq/+49RHo5c3yUNwKjl+reS1jp7BZk3XHm1H7IXiv Sda2sKpeDnduAIjtJLmyxo9ouB7VY4l3G8A/ZJad3w20DhrO0E2by5+fcCg0Q0LImTPkLK/ZbT/ hFX6yIQmJE8pAFyJcRnUalWwQ6NfPuGBu5bqlGfjkNoosx76nfD3/2VKn9ehFwaBf2EUhu1Nhaa UAG0If8UvUjSSfwm/YphrmKHrUfK+r24knzPvZ/zloNF7FT77oElqqi5vHopO55ysk5lhlqaOnw a87SxnFzLV1lkW8zg5/rsp7EMO4W0RgTS5bypPky4PnIwafKPwUCqSRhhVdwJ9yMjNEH5i6B9Xm dLMJIvlAcjXrK8w== 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: Francesco Dolcini , Tomi Valkeinen , linux-kernel@vger.kernel.org, stable@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. Cc: stable@vger.kernel.org Fixes: 32a1795f57ee ("drm/tidss: New driver for TI Keystone platform Display SubSystem") Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/tidss/tidss_crtc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/tidss/tidss_crtc.c b/drivers/gpu/drm/tidss/tidss_crtc.c index 5e5e466f35d1..7c78c074e3a2 100644 --- a/drivers/gpu/drm/tidss/tidss_crtc.c +++ b/drivers/gpu/drm/tidss/tidss_crtc.c @@ -169,13 +169,13 @@ 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 is %sactive, %s modeset, event %p\n", + __func__, crtc->name, crtc->state->active ? "" : "not ", + drm_atomic_crtc_needs_modeset(crtc->state) ? "needs" : "doesn't need", + 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; /* From patchwork Thu Nov 9 07:38:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 13450702 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 64ADCC4167D for ; Thu, 9 Nov 2023 07:39:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6279B10E1CF; Thu, 9 Nov 2023 07:39:03 +0000 (UTC) Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4099D10E1C5 for ; Thu, 9 Nov 2023 07:38:53 +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 919B28CD; Thu, 9 Nov 2023 08:38:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1699515510; bh=+jaNPtduetcEvhSP7u6BC4egR5EmPv/b6uS08H/KztU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=AsVZ7pcctQSiPyOw0SEvmSJkLI4kp0LZnRuQsCOhHeDnWLar5vqsjrMgqtxLgy2LD syDzZ+6TmaE5dPeJO7ySe96MzYnj3jvUkXjCNBMF36+mLChbrxs5g1JwXaTGFHcgeV gESZKz351l0kxkuKKADDHd9QT9h30hwJ2Uxqu7cg= From: Tomi Valkeinen Date: Thu, 09 Nov 2023 09:38:04 +0200 Subject: [PATCH v2 11/11] drm/tidss: Use DRM_PLANE_COMMIT_ACTIVE_ONLY MIME-Version: 1.0 Message-Id: <20231109-tidss-probe-v2-11-ac91b5ea35c0@ideasonboard.com> References: <20231109-tidss-probe-v2-0-ac91b5ea35c0@ideasonboard.com> In-Reply-To: <20231109-tidss-probe-v2-0-ac91b5ea35c0@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=2310; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=+jaNPtduetcEvhSP7u6BC4egR5EmPv/b6uS08H/KztU=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBlTIyBOL8n/raVGNTFxAt6t4oVrY3lRU98v9mD6 wDphIwh4YWJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZUyMgQAKCRD6PaqMvJYe 9XUvD/9JzEs7/j+qn0lz37oFW98QMakrkW9ly9/P/8fIlKNfmLjm6XaxkaldaDArWfd3nPy2bjK Td/Xz2a0t3opx9NcyDkuyaBYrkOkGsmY6XnB/Ik8hrE8On5C4V9OC/aXY30Ly0NZzgCom2NhV4C lR1JDRV7oJvzOe2GQ5Zr6z9UqnkLH0q+mHMVmXJ/o9D+nA9MlPpCYmgNKHQJFsfrLuQdGOaszvT YyQL3q78Ro+5OavI892p7olYrAd2/LmFkRstTzf8l3CGPb1VZFzFM4sHH3NoHycsGPA1Lbvje9u 8/ISjpjSmNzihCIbJrnzVgW/Sl5jyRN1sovgwE1bbBrOtfyxFejfhWwHNSSa3IRfaU2B4qIKDeh E6lwQe0Ws33WsXhDQJvJ2BQFYIzfyNu5ND5R3UvMCOlStvlTcy/1KuynTrbZeDfznLoAfqMHRYC a5NCD6b+df4PoownUg+NQteSkWko6Y3DghpRGfwHClpm3b5qqeNSl/0Xqa1kMRzUoSDif4Alfx3 xJDqMnt6cZZ13aPChj/deHRL3KpVDLqNfqWF3sA1HqViwjXG52KOI4/cxgZ6fdbzoYOHbwciHVu kMKfsNCtGlEOiCg3TkrbeRib6hvqC+gSApbfKGpMoM979GQIv2a2qQaM9tU0dmrXSV/wdDYiJPQ zj8HTwyz3y48EGA== 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 , Francesco Dolcini , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Laurent Pinchart Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" At the moment the driver does not use DRM_PLANE_COMMIT_ACTIVE_ONLY, but still checks for crtc->state->active in tidss_crtc_atomic_flush(), and skips the flush if the crtc is not active. The exact reason why DRM_PLANE_COMMIT_ACTIVE_ONLY is not used has been lost in history. DRM_PLANE_COMMIT_ACTIVE_ONLY does also affect the plane updates, and I think the issue was related to multi-display systems and moving planes between the displays. However, it is possible the issue was only present on the older DSS hardware, handled by the omapdrm driver (on which the tidss driver is loosely based). Reviewing the code related to DRM_PLANE_COMMIT_ACTIVE_ONLY does not show any issues, and testing on J7 EVM with two displays works fine. Change the driver to use DRM_PLANE_COMMIT_ACTIVE_ONLY. Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/tidss/tidss_crtc.c | 4 ---- drivers/gpu/drm/tidss/tidss_kms.c | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/gpu/drm/tidss/tidss_crtc.c b/drivers/gpu/drm/tidss/tidss_crtc.c index 7c78c074e3a2..5f838980c7a1 100644 --- a/drivers/gpu/drm/tidss/tidss_crtc.c +++ b/drivers/gpu/drm/tidss/tidss_crtc.c @@ -174,10 +174,6 @@ static void tidss_crtc_atomic_flush(struct drm_crtc *crtc, drm_atomic_crtc_needs_modeset(crtc->state) ? "needs" : "doesn't need", crtc->state->event); - /* There is nothing to do if CRTC is not going to be enabled. */ - if (!crtc->state->active) - return; - /* * Flush CRTC changes with go bit only if new modeset is not * coming, so CRTC is enabled trough out the commit. diff --git a/drivers/gpu/drm/tidss/tidss_kms.c b/drivers/gpu/drm/tidss/tidss_kms.c index d096d8d2bc8f..a0e494c806a9 100644 --- a/drivers/gpu/drm/tidss/tidss_kms.c +++ b/drivers/gpu/drm/tidss/tidss_kms.c @@ -29,7 +29,7 @@ static void tidss_atomic_commit_tail(struct drm_atomic_state *old_state) tidss_runtime_get(tidss); drm_atomic_helper_commit_modeset_disables(ddev, old_state); - drm_atomic_helper_commit_planes(ddev, old_state, 0); + drm_atomic_helper_commit_planes(ddev, old_state, DRM_PLANE_COMMIT_ACTIVE_ONLY); drm_atomic_helper_commit_modeset_enables(ddev, old_state); drm_atomic_helper_commit_hw_done(old_state);