Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp18732rdb; Mon, 22 Jan 2024 10:28:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IE8nZrJ7axYdaEPL8KWntYwy4lRjVV5XS4nrhRuGL2bm1BQ5ljFLhnhNWawSZuo+lj/6ve5 X-Received: by 2002:a05:651c:c8d:b0:2cf:2d0:d555 with SMTP id bz13-20020a05651c0c8d00b002cf02d0d555mr710060ljb.91.1705948117780; Mon, 22 Jan 2024 10:28:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705948117; cv=pass; d=google.com; s=arc-20160816; b=v5rH7g1E36USalRerjt5eu7GRslnYd8lSi/G9W2z9mhk906339qKwqhb4RbtsCJK7i /N8X9qi5uI5iWDq2LCuVi40cbywnFNFrE3Rr/i8zka0ow+6f5Jig1IULY3vb5R39yOtl hPZxAtMXNINqx5uZq7uf6w+/4mqpqf33qXg1yyv9+Xklx/QyesaH+QZREdoPH7mybnWh BPSKg890fYXHWzjwa2RfzrnbpQ6g0kBb9clMld+ip6m6wRoPOOkj1DAA5lJkF2Lvf6Eb +IEiyYMgCDWY0Zd6fX7y/R9lhYcNZ+K45OCIhNFuIYyH6W/k/tT3K1o7ycHkUjUI+84X nUNg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :sender:dkim-signature; bh=iRlYTVmwRF54QEgOCDB+moTbTPswdx4GRYVGmNIHl68=; fh=9YRL5xFlpLIYS4GdnibQe7V4xmHDcMVVa+vZIO+XVbc=; b=NphnvPafPVaugJYARtBRcBYl9IJZOfx9iCeAe97HOvyF5F1yi/98UvcCF59dvncGnt vx3dFaewDtMkxk6aihx34xvWGK3pfAoY8czFN20iWBHzTQaajknViWZ8oM2ZNHeTcfne I9ghde5y0aQQoussOdBGfRt9QWFAp8HBgyWFPdrs9M+p94AeTC15jXYwTeHApvRR3R2K C/kuk3DJiMbRNiPH1tTVIdZpPUwirk2yg0sS38v+GCr8drZa+Lv50N0oGBLdx6rDZk7V /zD6KZkCKiFdItvPyZrnmQhAG12D+7/ohli3e1ZPEZJL/m7N7r2TAzr4QV/kFxMd7BYT sLrg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Yog+BDAp; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-33846-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33846-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id d14-20020a50cd4e000000b0055c72de0fddsi77884edj.91.2024.01.22.10.28.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 10:28:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-33846-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Yog+BDAp; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-33846-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-33846-linux.lists.archive=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 am.mirrors.kernel.org (Postfix) with ESMTPS id 4E90F1F26DB2 for ; Mon, 22 Jan 2024 18:15:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 40BB846425; Mon, 22 Jan 2024 17:39:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Yog+BDAp" Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (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 D104F4642C; Mon, 22 Jan 2024 17:39:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705945172; cv=none; b=iPn+4zrKq9hIzR4DRxtkbY5V9X/bYxXq/HtLTM98RetPqebqeBe0oHLhufLcAty2qeacnTAZbLsLpKe+MlHNGGdf6nYcn0f+PYqJhhlSQhTMtxe1srJxjXTMvtw8cLJuYPe78Uqspy851Caz4YIThxSNnUUKA+wb1KyIy4vwpxo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705945172; c=relaxed/simple; bh=hfCd1Y5oYmxXeZ+dlaZix8KLaxz5lElV/rFBFaBiI98=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=GuLw/iJZ9jcN3QUBvqA5CVOh5wwND/OsG6NN0wQPYeeWUdQ7i2LBvoq+6BlU3MERV8a7C1RvEwgZhvUmfw+Mx/V5tILbs6kxKX2NQaXQhc3uvAXAKv8+Z3VQpMjxaKkkUlx9SPBVYVbAkxKdYoW231U5yjUy0RdTQpDyWXrvR7g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Yog+BDAp; arc=none smtp.client-ip=209.85.214.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-1d74dce86f7so10233225ad.2; Mon, 22 Jan 2024 09:39:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705945170; x=1706549970; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=iRlYTVmwRF54QEgOCDB+moTbTPswdx4GRYVGmNIHl68=; b=Yog+BDAp9WKLRGP3QHvNKVUpxA5sGv1LmgSBhB/nDyV0JuOL9lieXlK5yEgTXpZwVm MzQjyRkmlrBfbBihDY1zbi5Z1V5vLgblztnAMwjUpLo0mveaK/N0zPSAuL1Rkj4XIJw4 CvklL654x0b8YKmb6dpzRVWfD7bWXZ4ddbZC/QsIaRlMXG9djUslDBhUaawKLArXn8O5 15NE3C/ah38VvVYbNQvd5XBnWrfOwL7cMlMXlXkDo5Q/nEKmBRBNJrHCMsUY+mCqQ04+ 1e6SR9letSfo9T9izEdwiYMUAlkXNoKxWzA4sce3W7ovU6/vthuEG5zKHR70TDCCUW4G QCDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705945170; x=1706549970; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=iRlYTVmwRF54QEgOCDB+moTbTPswdx4GRYVGmNIHl68=; b=WSgBpLU3Y+yU9DY4OkC6XbhvRxGX50KEyH+4mojTWZ+7RSzi4KfFwC5xBc7QGdBxp4 MD5DOkFZ1GBVPLdUnlbh7YMNp30VEeofu7M6cfo0P1BN8XhqvB1ZU1tdsHeYfYa9mGSy 3Tg4FZBSXuiiPJ8qnju8LoFVIlDT4lyS0Gr1CpzdMSQ+xCaEEVSE9A8IzY9l+LxdPbh9 wcaN3klzpqx+EH/D3TkGd1GVCYGl3mcNS8EqXzV+EmE/qq1cJQBunfSX807qoytG0KG1 4MwZ8pdS0Dvwh4iasE43vEKr2BYk9ErDdt/olU12tXl6+sCKeC9bX465v1F4jbufGi5w PXSg== X-Gm-Message-State: AOJu0Yx+zHKjBc3RHANpcOV3ll1mfTvFAumGcoL3zbY1hDixHo+DaHPe MEQxROeqpIBUT83L6B16zkFYIGlmym4oeKKJqXGMBdAc1najlw1L X-Received: by 2002:a17:903:25d1:b0:1d7:ebe:9d4e with SMTP id jc17-20020a17090325d100b001d70ebe9d4emr4423977plb.92.1705945170002; Mon, 22 Jan 2024 09:39:30 -0800 (PST) Received: from ?IPV6:2600:1700:e321:62f0:329c:23ff:fee3:9d7c? ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id v20-20020a170902f0d400b001d74cee458asm2317033pla.107.2024.01.22.09.39.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 22 Jan 2024 09:39:29 -0800 (PST) Sender: Guenter Roeck Message-ID: Date: Mon, 22 Jan 2024 09:39:27 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 07/10] watchdog: rzg2l_wdt: Add suspend/resume support Content-Language: en-US To: Claudiu , wim@linux-watchdog.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, geert+renesas@glider.be, magnus.damm@gmail.com, mturquette@baylibre.com, sboyd@kernel.org, p.zabel@pengutronix.de, 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, linux-clk@vger.kernel.org, Claudiu Beznea References: <20240122111115.2861835-1-claudiu.beznea.uj@bp.renesas.com> <20240122111115.2861835-8-claudiu.beznea.uj@bp.renesas.com> From: Guenter Roeck Autocrypt: addr=linux@roeck-us.net; keydata= xsFNBE6H1WcBEACu6jIcw5kZ5dGeJ7E7B2uweQR/4FGxH10/H1O1+ApmcQ9i87XdZQiB9cpN RYHA7RCEK2dh6dDccykQk3bC90xXMPg+O3R+C/SkwcnUak1UZaeK/SwQbq/t0tkMzYDRxfJ7 nyFiKxUehbNF3r9qlJgPqONwX5vJy4/GvDHdddSCxV41P/ejsZ8PykxyJs98UWhF54tGRWFl 7i1xvaDB9lN5WTLRKSO7wICuLiSz5WZHXMkyF4d+/O5ll7yz/o/JxK5vO/sduYDIlFTvBZDh gzaEtNf5tQjsjG4io8E0Yq0ViobLkS2RTNZT8ICq/Jmvl0SpbHRvYwa2DhNsK0YjHFQBB0FX IdhdUEzNefcNcYvqigJpdICoP2e4yJSyflHFO4dr0OrdnGLe1Zi/8Xo/2+M1dSSEt196rXaC kwu2KgIgmkRBb3cp2vIBBIIowU8W3qC1+w+RdMUrZxKGWJ3juwcgveJlzMpMZNyM1jobSXZ0 VHGMNJ3MwXlrEFPXaYJgibcg6brM6wGfX/LBvc/haWw4yO24lT5eitm4UBdIy9pKkKmHHh7s jfZJkB5fWKVdoCv/omy6UyH6ykLOPFugl+hVL2Prf8xrXuZe1CMS7ID9Lc8FaL1ROIN/W8Vk BIsJMaWOhks//7d92Uf3EArDlDShwR2+D+AMon8NULuLBHiEUQARAQABzTJHdWVudGVyIFJv ZWNrIChMaW51eCBhY2NvdW50KSA8bGludXhAcm9lY2stdXMubmV0PsLBgQQTAQIAKwIbAwYL CQgHAwIGFQgCCQoLBBYCAwECHgECF4ACGQEFAlVcphcFCRmg06EACgkQyx8mb86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ssf5i5Q= In-Reply-To: <20240122111115.2861835-8-claudiu.beznea.uj@bp.renesas.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 1/22/24 03:11, Claudiu wrote: > From: Claudiu Beznea > > 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 > --- > 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 9333dc1a75ab..186796b739f7 100644 > --- a/drivers/watchdog/rzg2l_wdt.c > +++ b/drivers/watchdog/rzg2l_wdt.c > @@ -279,6 +279,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; > @@ -300,10 +301,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 = pm_ptr(&rzg2l_wdt_pm_ops), I think this will create a build error if CONFIG_PM=n because rzg2l_wdt_pm_ops will be unused but is not marked with __maybe_unused. But then the driver won't be operational with CONFIG_PM=n, so I really wonder if it makes sense to include any such conditional code instead of making the driver depend on CONFIG_PM. I really don't think it is desirable to suggest that the driver would work with CONFIG_PM=n if that isn't really true. Guenter > }, > .probe = rzg2l_wdt_probe, > };