From nobody Fri Sep 19 03:48:28 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECFE0C4167B for ; Tue, 29 Nov 2022 19:19:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236802AbiK2TT2 (ORCPT ); Tue, 29 Nov 2022 14:19:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236230AbiK2TTI (ORCPT ); Tue, 29 Nov 2022 14:19:08 -0500 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A63B6C705 for ; Tue, 29 Nov 2022 11:18:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1669749479; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BEjxKDNm3i4FDiWmBekbtVQ5t/EpC9nOnul1c9i1i1M=; b=Taryu9xn7LuS8c0dGYEZkB9nNj0a7nz0bW0TjxOfTRSglh8anKk2e3H8RCb0mxFe8jiqET h9AlKR8lJOljzO1Dly2Ye7OAmnAkZoamwKHHwPKR0XQ3eHAw2F6kGRNsVQc/7fqXBe7P+b BOJYFPUGDN8RVcomPQ2KFZyZPc9daao= From: Paul Cercueil To: David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Paul Cercueil , Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev Subject: [PATCH v2 06/26] drm: sun4i: Define and use generic PM ops Date: Tue, 29 Nov 2022 19:17:13 +0000 Message-Id: <20221129191733.137897-7-paul@crapouillou.net> In-Reply-To: <20221129191733.137897-1-paul@crapouillou.net> References: <20221129191733.137897-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use the new DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS() macro to create a "struct dev_pm_ops" that can be used by this driver, instead of using custom PM callbacks with the same behaviour. v2: Use the DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS() macro instead of an exported dev_pm_ops. Signed-off-by: Paul Cercueil Reviewed-by: Samuel Holland --- Samuel: since the code changed I had to remove your reviewed-by, sorry about that. Cc: Maxime Ripard Cc: Chen-Yu Tsai Cc: Jernej Skrabec Cc: Samuel Holland Cc: linux-arm-kernel@lists.infradead.org Cc: linux-sunxi@lists.linux.dev --- drivers/gpu/drm/sun4i/sun4i_drv.c | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4= i_drv.c index cc94efbbf2d4..178ada09b467 100644 --- a/drivers/gpu/drm/sun4i/sun4i_drv.c +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c @@ -13,6 +13,7 @@ #include #include #include +#include =20 #include #include @@ -339,27 +340,6 @@ static int sun4i_drv_add_endpoints(struct device *dev, return count; } =20 -#ifdef CONFIG_PM_SLEEP -static int sun4i_drv_drm_sys_suspend(struct device *dev) -{ - struct drm_device *drm =3D dev_get_drvdata(dev); - - return drm_mode_config_helper_suspend(drm); -} - -static int sun4i_drv_drm_sys_resume(struct device *dev) -{ - struct drm_device *drm =3D dev_get_drvdata(dev); - - return drm_mode_config_helper_resume(drm); -} -#endif - -static const struct dev_pm_ops sun4i_drv_drm_pm_ops =3D { - SET_SYSTEM_SLEEP_PM_OPS(sun4i_drv_drm_sys_suspend, - sun4i_drv_drm_sys_resume) -}; - static int sun4i_drv_probe(struct platform_device *pdev) { struct component_match *match =3D NULL; @@ -434,13 +414,15 @@ static const struct of_device_id sun4i_drv_of_table[]= =3D { }; MODULE_DEVICE_TABLE(of, sun4i_drv_of_table); =20 +DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS(sun4i_pm_ops); + static struct platform_driver sun4i_drv_platform_driver =3D { .probe =3D sun4i_drv_probe, .remove =3D sun4i_drv_remove, .driver =3D { .name =3D "sun4i-drm", .of_match_table =3D sun4i_drv_of_table, - .pm =3D &sun4i_drv_drm_pm_ops, + .pm =3D pm_sleep_ptr(&sun4i_pm_ops), }, }; drm_module_platform_driver(sun4i_drv_platform_driver); --=20 2.35.1