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: 160485 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:abcd:0:b0:403:3b70:6f57 with SMTP id f13csp282942vqx; Wed, 1 Nov 2023 02:20:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHpJPlsRYXkS8tb6M2dKeBaTUHhA8yBacr3u++MfcmM+R/kZtMzN677amHCZVVfBdnx2K8M X-Received: by 2002:a17:903:41cd:b0:1cc:4e81:36a4 with SMTP id u13-20020a17090341cd00b001cc4e8136a4mr9467860ple.5.1698830430652; Wed, 01 Nov 2023 02:20:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698830430; cv=none; d=google.com; s=arc-20160816; b=Mjg3aIrPAUhVGS6pqBaZJ37UiB4ci25yZih9rnNck+IZxbPz+gRVCBQupsJ21PPnkk /2X7Hbri7tc0dx1I/aeLa6uM2iNio2JzTE6oaHWk1U36hbkV7WnmCFUFOJvwm/ImM81z 3w4XwL9ysdu7qVvRdHC8l0b34UOEMkFwYeYj7i40izAeVV3IutrcuBKrkzQ0u8TnnHJJ SOKV6pKNyDic/ZO3VfhuEzBKePRTaz7G5nE1URRrUEyOoDr0Vu5b36CMdhlELAvPYbsw 2VcogMPwDi7zIPX4jaSPjt5UT9YwxaZEEqo/QhF7kulL9/TlF/eaF+WVUgH/FgOMt/iT gB6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=rTkgHUFMvxn4JcTUjQc+DNPxmIHMXGBQsHHL8tpXzFk=; fh=IpenHstmzluQ2qG4rgZds4W72uLPbZNMEjQq5GLr0+k=; b=m9f5yWdU8j0QVCnHV5R61IDtRsJFhqVgjo0eeUGtKmzls3vDrn2FTPkJl6vbWF1usw /Jd7zZKZHXMtnH+fMLpurYrif3oK9RQTRSsHqu7K3d60u8I53IIgaxyjEu9Tl1Xs3JOw 9JhEuqIGdE8xRmPfWnn2H30+Y8jv+GyMaB2mAxZjkFiA+2sclxKH/SDIIBHF1z+ioMWp M02bE3hJNqmJfXws6n34HlYLBqKdbphG9zJ55Cr45Ikz3edHzrGjD2TLzCtdELDXJgLD kNPxPd4SwBQshA6GaLJCVdf0XJDL9yOSFDsTk0r9zCr1jMV3kU+6s4n0QxpavQETD6JM sPIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=N4Lf32+M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id n3-20020a170902d2c300b001c9d03042b6si2638472plc.7.2023.11.01.02.20.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 02:20:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=N4Lf32+M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 2DE06805B9F7; Wed, 1 Nov 2023 02:20:15 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232927AbjKAJT2 (ORCPT + 35 others); Wed, 1 Nov 2023 05:19:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234097AbjKAJT0 (ORCPT ); Wed, 1 Nov 2023 05:19:26 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 287BAD4B for ; Wed, 1 Nov 2023 02:19:03 -0700 (PDT) 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 Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Laurent Pinchart , Tomi Valkeinen 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-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 01 Nov 2023 02:20:15 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781352817719330605 X-GMAIL-MSGID: 1781352817719330605 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");