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 8D0E8C4332F for ; Tue, 29 Nov 2022 19:18:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236717AbiK2TSb (ORCPT ); Tue, 29 Nov 2022 14:18:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236574AbiK2TSW (ORCPT ); Tue, 29 Nov 2022 14:18:22 -0500 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 305E44298F for ; Tue, 29 Nov 2022 11:18:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1669749472; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=G8DuH3BuKovOG4Q7ExNfPyHxexqJONRgTC1VLQg6L9Q=; b=XeDFUB1JkUgh0wnq9Xls3sBZht0UmGP/izWeb/iRwRNzHrS979IvpylbCjC2/q+8aUq3tT EOXMv8WFDy5gjLgrVnvlKo9WSBkpvLWBCb0cWc69f1vAl/XjHyvw2TCphvzX22HwJnUhIf 4WmBhw+t+MczTtU+iytYxf4ZzAVrONY= From: Paul Cercueil To: David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Paul Cercueil , Sandy Huang , =?UTF-8?q?Heiko=20St=C3=BCbner?= , linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org Subject: [PATCH v2 04/26] drm: rockchip: Define and use generic PM ops Date: Tue, 29 Nov 2022 19:17:11 +0000 Message-Id: <20221129191733.137897-5-paul@crapouillou.net> In-Reply-To: <20221129191733.137897-1-paul@crapouillou.net> References: <20221129191733.137897-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- Cc: Sandy Huang Cc: "Heiko St=C3=BCbner" Cc: linux-arm-kernel@lists.infradead.org Cc: linux-rockchip@lists.infradead.org --- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 25 +++------------------ 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/= rockchip/rockchip_drm_drv.c index 6e0788d14c10..ec117c52cb24 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -236,27 +236,6 @@ static const struct drm_driver rockchip_drm_driver =3D= { .minor =3D DRIVER_MINOR, }; =20 -#ifdef CONFIG_PM_SLEEP -static int rockchip_drm_sys_suspend(struct device *dev) -{ - struct drm_device *drm =3D dev_get_drvdata(dev); - - return drm_mode_config_helper_suspend(drm); -} - -static int rockchip_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 rockchip_drm_pm_ops =3D { - SET_SYSTEM_SLEEP_PM_OPS(rockchip_drm_sys_suspend, - rockchip_drm_sys_resume) -}; - #define MAX_ROCKCHIP_SUB_DRIVERS 16 static struct platform_driver *rockchip_sub_drivers[MAX_ROCKCHIP_SUB_DRIVE= RS]; static int num_rockchip_sub_drivers; @@ -473,6 +452,8 @@ static const struct of_device_id rockchip_drm_dt_ids[] = =3D { }; MODULE_DEVICE_TABLE(of, rockchip_drm_dt_ids); =20 +DEFINE_DRM_MODE_CONFIG_HELPER_PM_OPS(rockchip_pm_ops); + static struct platform_driver rockchip_drm_platform_driver =3D { .probe =3D rockchip_drm_platform_probe, .remove =3D rockchip_drm_platform_remove, @@ -480,7 +461,7 @@ static struct platform_driver rockchip_drm_platform_dri= ver =3D { .driver =3D { .name =3D "rockchip-drm", .of_match_table =3D rockchip_drm_dt_ids, - .pm =3D &rockchip_drm_pm_ops, + .pm =3D pm_sleep_ptr(&rockchip_pm_ops), }, }; =20 --=20 2.35.1