Message ID | 20240228083253.2640997-9-claudiu.beznea.uj@bp.renesas.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-84684-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp3214196dyb; Wed, 28 Feb 2024 00:46:14 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW2KBuIDZMjua/x6t8DegHz7N0EGhL/KaFPqs0w29gMjhVwucYRfKBV6efxvSgcA1Epd30zzQCFB2sIRxIN7brVFYqdBw== X-Google-Smtp-Source: AGHT+IHd47SinH2XjTOJ+5hGj9AMC2fCeaHPOmF59oX+xMRWyqLEJt1t1JGA2T8DRYVUcukTevUH X-Received: by 2002:a17:90a:d78d:b0:299:344f:b3d5 with SMTP id z13-20020a17090ad78d00b00299344fb3d5mr9235245pju.3.1709109974078; Wed, 28 Feb 2024 00:46:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709109974; cv=pass; d=google.com; s=arc-20160816; b=vXK9sAIODu0GGwmIarNSdY5sI8NGrXkUbwk3yspTMnJ+1yvNsoEM1Vyzwgl5lWL7R1 a+5k3OetlTJDJ/M9erwvZXpFMyTVSEf3/pso7yPTKkai+xE9oHqvPJMxHZlM+pHwn1Z1 /EDyYJbqDtih81mUDW1Ldlbkrp0qccSMysAxapkUZ2wRCxB+3gCni9RksWR2ZeD+1/yu DC1g0VmxwOlgaleZUAEbNHxVW2MPEeds1rP3hNVuxPaUyzs+RbG1vNwEEa9ZDhNilYJx V820QLcbKTc/fb2RU8sl4C4Giv692bwYiIsuRCZgeX0Ear52T7PnYVFKe/rpFESyrfiG GimQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=GjCAC+2PerafieMHV8RN2guxKuMHo8tOwc6kR6Aqv5E=; fh=rsWzAXt6rw/QbO8Mdx56fdsEykr2W0+HzHS3nEFJv0I=; b=lzQzexm69egz0k3P+8moDpslt1GQVhIoEm8HpD1Wz+OXQDEC1Hmny8SRVhxUCCTMzN Q6UcYKb5jOhLkE0dKmfvW5d6xuMYHGolPradU2xy1O6Oo85KLxS6/wBf6PTEsQEe7gju XUfw/EAYuC8ZVuybGTPyHRWvVxEVstm/aHgdg/qDlxSJoHkgssD9Ns8stQk9Y37hsP/I cORTgynxpECl9KTSPi8+1gmCQ4YNN7J7MIsQoS+fkz1F6GuV8G8MFtLHImEbpzSVPORu 4wHXib5++z/3sFppjezYG+77Uk2DuGoAjZPp8h05Ml2UmbOZ/jCF2OMIFjN2mp2im5EE dYow==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=Tc6OO+fU; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-84684-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84684-ouuuleilei=gmail.com@vger.kernel.org" Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id r20-20020a632054000000b005d8d56cd646si6731303pgm.130.2024.02.28.00.46.13 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 00:46:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84684-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=Tc6OO+fU; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-84684-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84684-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 302B2B27CE9 for <ouuuleilei@gmail.com>; Wed, 28 Feb 2024 08:35:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 77CAD38390; Wed, 28 Feb 2024 08:33:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="Tc6OO+fU" Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 79A54374EA for <linux-kernel@vger.kernel.org>; Wed, 28 Feb 2024 08:33:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709109209; cv=none; b=P7NbFefbsnmjCvARffsKnObbOu/c4K4Dww5bscJg+vbRmHfWuxZPON5Uwd7U7OcxIcCTlBedz28b24LoJEB4hoWAcwQce074l6D8SV+lAfl5aut5LJQV+ayX2R7s+w+bvHmzdSBHMARwbLPGDgmxp2rcPKa5hO3pNMaOsXinMNE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709109209; c=relaxed/simple; bh=xpEy60wLCww6Rzj9qsFI342NwmQkdCt2ZTEg/Fiucao=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mZ2Zf6yn2JDKH7xDLSdeYdoYs9+dygQs44GejsCQ4EqsW+kO7/0ubbkyPzHJBO7K1Fx5jdl6XGtCnoMe3aPVvTKy+4d3XbKXVzo71YvD4KpHVT3iGXsOaH3D6xK6oehEjAr+hKWA0brMt0Aw5wuUxD6X2WxNEUL4HGXTqZlIAYc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=Tc6OO+fU; arc=none smtp.client-ip=209.85.218.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-a3d5e77cfbeso109069966b.0 for <linux-kernel@vger.kernel.org>; Wed, 28 Feb 2024 00:33:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1709109206; x=1709714006; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GjCAC+2PerafieMHV8RN2guxKuMHo8tOwc6kR6Aqv5E=; b=Tc6OO+fUTOKmKwLJsUx13q2P9pAcQaEPdAnUsBsvfA6iC5HsVbxYFtIR3J9E4lgq7l yHGuSDXfqG8UiKZOVAKbErSDtjicSmbukP7g+iR5vOvHYSVr6B7UHZZvJ8lPfBnzY6L8 o0tnPe/sCrvmAu/QpxZA1An3KX/Z+t6gPP87yDVnx+GYJyN3XIeSEzflXmr9hEl6jOU/ rNz54GIniDUtKlaNzDuqXDMRAwyIZG6c0ItWa/DRFeGwmwnCKYhELwnjy9CPGTGt7bv7 NgN7ygBjzS1ZXRWx09xssZ2X1n+SwArysj61yPO5k86dJ4nD13IVMW+Q/eL8cG2wgJKV a5xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709109206; x=1709714006; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GjCAC+2PerafieMHV8RN2guxKuMHo8tOwc6kR6Aqv5E=; b=HFwXlrlTnTyRXJEgRFB6f2GrGh4aXpndx6pZ52Up6DlzlMUbscG3p2NTJe7IaM/z0V XnXdTPtd6g1tW7AgbiPO3VIxB2omCuvqkWPB1UHAljysSuWgBYMQTbCssyi7nfRL3lrO bbOW8YbkyUFfD2BSxr2w5Ot6YcEMAWO9PGHJg4GKff7hnByo05Mu5lkKMuaFG2aVm3y8 xKtQZ6zsNsUJK8rbSslFvPmJFToEejTJOJ3++0yR0HMiZ8Fn5kRVcdlDkAub3MKhURbA QCBTBFq6qI5xafCjRVu/rYysZWF5kGL2si1wFFSE3aDXOEf/tgX2iaOZUBA8WrJ/eTn9 1WfQ== X-Forwarded-Encrypted: i=1; AJvYcCXbdVwssrRRUunH9VsQpmj9xHaZAwNZsoNFctcLmRYiecPLm5LxyAaCpStvuwSKR+BiPBMqRzBWZfyLAAsRy+H7nFpsSwn3fib6uQat X-Gm-Message-State: AOJu0Yy6VCwtTbiPi5sHjRvHyIM2n6LtCf0jb01ERDohi7iX5XEr+JsB fxULfxVhAy6zJKIKqTA1+Cm6Xx3T3b7AULTg8SOl+hF6zu3mqH9INBKWKeUcNuY= X-Received: by 2002:a17:906:f357:b0:a44:591:a3d8 with SMTP id hg23-20020a170906f35700b00a440591a3d8mr669462ejb.31.1709109205764; Wed, 28 Feb 2024 00:33:25 -0800 (PST) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.83]) by smtp.gmail.com with ESMTPSA id qh16-20020a170906ecb000b00a432777eb77sm1593987ejb.60.2024.02.28.00.33.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 00:33:25 -0800 (PST) From: Claudiu <claudiu.beznea@tuxon.dev> X-Google-Original-From: Claudiu <claudiu.beznea.uj@bp.renesas.com> To: wim@linux-watchdog.org, linux@roeck-us.net, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, p.zabel@pengutronix.de, geert+renesas@glider.be, magnus.damm@gmail.com, biju.das.jz@bp.renesas.com Cc: linux-watchdog@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, claudiu.beznea@tuxon.dev, Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> Subject: [PATCH v8 08/10] watchdog: rzg2l_wdt: Add suspend/resume support Date: Wed, 28 Feb 2024 10:32:51 +0200 Message-Id: <20240228083253.2640997-9-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240228083253.2640997-1-claudiu.beznea.uj@bp.renesas.com> References: <20240228083253.2640997-1-claudiu.beznea.uj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792131700456627637 X-GMAIL-MSGID: 1792131700456627637 |
Series |
watchdog: rzg2l_wdt: Add support for RZ/G3S
|
|
Commit Message
claudiu beznea
Feb. 28, 2024, 8:32 a.m. UTC
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> The RZ/G3S supports deep sleep states where power to most of the IP blocks is cut off. To ensure proper working of the watchdog when resuming from such states, the suspend function is stopping the watchdog and the resume function is starting it. There is no need to configure the watchdog in case the watchdog was stopped prior to starting suspend. Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> --- Changes in v8: - none Changes in v7: - none Changes in v6: - none Changes in v5: - none Changes in v4: - none Changes in v3: - none Changes in v2: - remove the usage of pm_ptr() drivers/watchdog/rzg2l_wdt.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
diff --git a/drivers/watchdog/rzg2l_wdt.c b/drivers/watchdog/rzg2l_wdt.c index 42f1d5d6f07e..c8c20cfb97a3 100644 --- a/drivers/watchdog/rzg2l_wdt.c +++ b/drivers/watchdog/rzg2l_wdt.c @@ -284,6 +284,7 @@ static int rzg2l_wdt_probe(struct platform_device *pdev) priv->wdev.timeout = WDT_DEFAULT_TIMEOUT; watchdog_set_drvdata(&priv->wdev, priv); + dev_set_drvdata(dev, priv); ret = devm_add_action_or_reset(&pdev->dev, rzg2l_wdt_pm_disable, &priv->wdev); if (ret) return ret; @@ -305,10 +306,35 @@ static const struct of_device_id rzg2l_wdt_ids[] = { }; MODULE_DEVICE_TABLE(of, rzg2l_wdt_ids); +static int rzg2l_wdt_suspend_late(struct device *dev) +{ + struct rzg2l_wdt_priv *priv = dev_get_drvdata(dev); + + if (!watchdog_active(&priv->wdev)) + return 0; + + return rzg2l_wdt_stop(&priv->wdev); +} + +static int rzg2l_wdt_resume_early(struct device *dev) +{ + struct rzg2l_wdt_priv *priv = dev_get_drvdata(dev); + + if (!watchdog_active(&priv->wdev)) + return 0; + + return rzg2l_wdt_start(&priv->wdev); +} + +static const struct dev_pm_ops rzg2l_wdt_pm_ops = { + LATE_SYSTEM_SLEEP_PM_OPS(rzg2l_wdt_suspend_late, rzg2l_wdt_resume_early) +}; + static struct platform_driver rzg2l_wdt_driver = { .driver = { .name = "rzg2l_wdt", .of_match_table = rzg2l_wdt_ids, + .pm = &rzg2l_wdt_pm_ops, }, .probe = rzg2l_wdt_probe, };