Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1205256pxb; Wed, 6 Apr 2022 11:16:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAdY6qs8rzyyuELHdfbiVN0ax/pcfD2YOTqNM32cG6pGmH8getze7wsX+N61cQK4JGbEJZ X-Received: by 2002:a17:90a:ef12:b0:1ca:487d:a29f with SMTP id k18-20020a17090aef1200b001ca487da29fmr11420160pjz.243.1649268970531; Wed, 06 Apr 2022 11:16:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649268970; cv=none; d=google.com; s=arc-20160816; b=az5fQgICw5NwUr6ZMkVsbGlx1VdHeoIiGQ+BTtuls+lBCmR7cjKXDEw+EhnPtBePw3 1eXQBFx5jZmgaYyJdeyCvD9sm/1EVdQ34GcPCfRyx0cgzY5Xmc1xV1TlKBHsX0tAg2T8 DPrws4wKbcqZ2Eb8xnrGERY4jSxlej1oC/Y8aNAbmL4zmsEkcChMk0kbIY6koJ8w7Klt 8tRH25LijDrm9u0c7Gf/XvaWNtN25mbVLN6GYKMYF4tjYo9GB6cYq0XkbSFqDnytdEkZ C+KYJqqFVPZVD6WW6XCXsbIJHcl5xgREsefFjGOrPbUeNxRS2/NbYokDPBZ0Leq/qleE UbKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=iJllXUpMLht5eQ4Hb5gQWcUNhXLw2Nxvqi/AGm4OCco=; b=rtFhFed41u8Wz4QieYBjLGQXVxHXWt7QM46pdfRMY4mQzrgfO3WnUoKGWZksMU/mwm Bh+GevNmnFLmUs0iFhQgNmaub0S6BaDi1ATYX0I4H9HoNx0X+mk71Hj9JjTTyCeygU8T kLHHqNFYIwF5QEDWVVT7HnhWjH6b6rHuGB+37OA1NPFiDyNVXeNd3yOfndMqEFn+YreC GhD9bHq1HYiPPZiYboaThYkB4LwfEZeA5lB9WwdBVEam8CXWhOtMDbfTQrMTlvsvEEIk wspO6dS+tsax+jcdkhej0qPlxEDhyi/eKNAqlsOvEhXNXIE+n+3S08dpLeubBzSW3GQi r3DA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id s11-20020a17090302cb00b00153b2d1643dsi12004052plk.69.2022.04.06.11.16.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 11:16:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CA039C6F26; Wed, 6 Apr 2022 11:01:52 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239835AbiDFSDn (ORCPT + 99 others); Wed, 6 Apr 2022 14:03:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240121AbiDFSCe (ORCPT ); Wed, 6 Apr 2022 14:02:34 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5A92202888 for ; Wed, 6 Apr 2022 09:37:05 -0700 (PDT) Received: from dude03.red.stw.pengutronix.de ([2a0a:edc0:0:1101:1d::39]) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1nc8eU-00087T-9K; Wed, 06 Apr 2022 18:37:02 +0200 From: Lucas Stach To: Thomas Gleixner , Marc Zyngier Cc: Pengutronix Kernel Team , NXP Linux Team , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, patchwork-lst@pengutronix.de Subject: [PATCH 2/2] irqchip/imx-irqsteer: add runtime PM support Date: Wed, 6 Apr 2022 18:37:01 +0200 Message-Id: <20220406163701.1277930-2-l.stach@pengutronix.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220406163701.1277930-1-l.stach@pengutronix.de> References: <20220406163701.1277930-1-l.stach@pengutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2a0a:edc0:0:1101:1d::39 X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There are now SoCs that integrate the irqsteer controller within a separate power domain. In order to allow this domain to be powered down when not needed, add runtime PM support to the driver. Signed-off-by: Lucas Stach --- drivers/irqchip/irq-imx-irqsteer.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/irqchip/irq-imx-irqsteer.c b/drivers/irqchip/irq-imx-irqsteer.c index e286e7c5ccbf..96230a04ec23 100644 --- a/drivers/irqchip/irq-imx-irqsteer.c +++ b/drivers/irqchip/irq-imx-irqsteer.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #define CTRL_STRIDE_OFF(_t, _r) (_t * 4 * _r) @@ -175,7 +176,7 @@ static int imx_irqsteer_probe(struct platform_device *pdev) data->irq_count = DIV_ROUND_UP(irqs_num, 64); data->reg_num = irqs_num / 32; - if (IS_ENABLED(CONFIG_PM_SLEEP)) { + if (IS_ENABLED(CONFIG_PM)) { data->saved_reg = devm_kzalloc(&pdev->dev, sizeof(u32) * data->reg_num, GFP_KERNEL); @@ -199,6 +200,7 @@ static int imx_irqsteer_probe(struct platform_device *pdev) ret = -ENOMEM; goto out; } + irq_domain_set_pm_device(data->domain, &pdev->dev); if (!data->irq_count || data->irq_count > CHAN_MAX_OUTPUT_INT) { ret = -EINVAL; @@ -219,6 +221,9 @@ static int imx_irqsteer_probe(struct platform_device *pdev) platform_set_drvdata(pdev, data); + pm_runtime_set_active(&pdev->dev); + pm_runtime_enable(&pdev->dev); + return 0; out: clk_disable_unprepare(data->ipg_clk); @@ -241,7 +246,7 @@ static int imx_irqsteer_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM_SLEEP +#ifdef CONFIG_PM static void imx_irqsteer_save_regs(struct irqsteer_data *data) { int i; @@ -288,7 +293,10 @@ static int imx_irqsteer_resume(struct device *dev) #endif static const struct dev_pm_ops imx_irqsteer_pm_ops = { - SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(imx_irqsteer_suspend, imx_irqsteer_resume) + SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) + SET_RUNTIME_PM_OPS(imx_irqsteer_suspend, + imx_irqsteer_resume, NULL) }; static const struct of_device_id imx_irqsteer_dt_ids[] = { -- 2.30.2