From patchwork Wed Jun 29 11:06:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaac True X-Patchwork-Id: 12899788 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 AB710C433EF for ; Wed, 29 Jun 2022 11:07:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229811AbiF2LHa (ORCPT ); Wed, 29 Jun 2022 07:07:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229845AbiF2LHZ (ORCPT ); Wed, 29 Jun 2022 07:07:25 -0400 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D00D43D1E8 for ; Wed, 29 Jun 2022 04:07:23 -0700 (PDT) Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 8940041012 for ; Wed, 29 Jun 2022 11:07:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1656500842; bh=s7/yNxuq40RrKk0Bz5LG0QXWmTYN2ZnVslg7p7peeiE=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=BTR+ebQzdnm4XjQ2PPerIAej5DgqY9ZgiWUBkcsrd/DcUWUSBzMDXuldXSDsV4N9e ycZfKNeKa3bQTV2/J/o0ysMOn6cRptN0sxk7rJsENrzbrQ+XVh2dD5IKQ4SkaYk9Sn qA2MQQglFEyXL5b1L1JmgZeEJubmuxZNr/VoNJD2v1F6ORamUxUsHQkpRxVTLHaszw oI6AEW73sEOS+L+QjXv77RhXh1n1tREFF3Ldwj8EbuvtPTkXRFTi139ucB59wSjFdm CbAzifvBZehIj4vgJOlmNTP3f1DWhlnvM0e2y+ndeQuFrOSVNsdPHtjcmKnwkVt0rE 8DGShLvwLezpA== Received: by mail-ed1-f72.google.com with SMTP id v16-20020a056402349000b00435a1c942a9so11788729edc.15 for ; Wed, 29 Jun 2022 04:07:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=s7/yNxuq40RrKk0Bz5LG0QXWmTYN2ZnVslg7p7peeiE=; b=cp9U1k7KUxb8V932UjeqFQpx/8o/kllWEZ6BwMSAw7ohmihJIA8KcFUgFVawetSxND LamHENeE7QhxG9nIwMlEFwNgrFbExaHlYWKaMaeUYi5s+UvyaSJupWDNCohmDhWK3ePX ihP1WVSakQ0TPDjtX114utmbhdqnIMJWyxVemkKlvnTrb3RcZE6iC/u78/4WNG7AecAI qULIPcdsLXV2ageioFKF8dR5MU6poOOmGFFSi1+3QBNT+I0+WGugsO+5KP2jz3qxCiNN 5a+eCkgWTTrq6kegdeLsuVV/Tpinesl45GSpxOBE7uywPNq7IIhgEfag7+SN9sBqC1TD MDWA== X-Gm-Message-State: AJIora/AQnBs0k8+RL7e5vjAGyDwablKXpIboUG30RUz0QPRPpt5P41d OGuBkNrUpX+g6lK8caaPz4eVlAR5qs8qzewJm7GlGjPoJMif0ATpG3kvdxKmMAf+Ew7NLfYS3Wi bDnKVDdZZJDntQlelmtlErbgu0lUATAlNKG4/hTj+v5VW X-Received: by 2002:a17:906:6545:b0:722:7c99:1ad7 with SMTP id u5-20020a170906654500b007227c991ad7mr2738179ejn.325.1656500841105; Wed, 29 Jun 2022 04:07:21 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sKWzKffTLYTO8eiGO8f6TCl+ogtMvFqx7iN8S/I3sXiDkEvulKUNZaeOvQuHQ0kxAuN1DX5A== X-Received: by 2002:a17:906:6545:b0:722:7c99:1ad7 with SMTP id u5-20020a170906654500b007227c991ad7mr2738159ejn.325.1656500840947; Wed, 29 Jun 2022 04:07:20 -0700 (PDT) Received: from Isaac-Laptop.fritz.box ([2a02:908:672:1020:dd2a:5258:a4c9:43ea]) by smtp.gmail.com with ESMTPSA id r1-20020aa7cb81000000b004357b717a96sm11127630edt.85.2022.06.29.04.07.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jun 2022 04:07:20 -0700 (PDT) From: Isaac True To: linux-watchdog@vger.kernel.org Cc: devicetree@vger.kernel.org, wim@linux-watchdog.org, linux@roeck-us.net, Isaac True Subject: [PATCH 1/2] dt-bindings: watchdog: gpio: add minimum interval Date: Wed, 29 Jun 2022 13:06:25 +0200 Message-Id: <20220629110626.2158127-1-isaac.true@canonical.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org Add the "min_hw_margin_ms" parameter to gpio_wdt devices, allowing a minimum interval to be specified, stopping watchdog devices from being fed too quickly if they require a certain interval between feeds. Signed-off-by: Isaac True --- Documentation/devicetree/bindings/watchdog/gpio-wdt.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/watchdog/gpio-wdt.txt b/Documentation/devicetree/bindings/watchdog/gpio-wdt.txt index 198794963786..4f13dbbf12fd 100644 --- a/Documentation/devicetree/bindings/watchdog/gpio-wdt.txt +++ b/Documentation/devicetree/bindings/watchdog/gpio-wdt.txt @@ -12,6 +12,8 @@ Required Properties: the opposite level disables the WDT. Active level is determined by the GPIO flags. - hw_margin_ms: Maximum time to reset watchdog circuit (milliseconds). +- min_hw_margin_ms: Minimum time to reset watchdog circuit (milliseconds). + Defaults to 0 ms. Optional Properties: - always-running: If the watchdog timer cannot be disabled, add this flag to From patchwork Wed Jun 29 11:06:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaac True X-Patchwork-Id: 12899787 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 36935C43334 for ; Wed, 29 Jun 2022 11:07:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229828AbiF2LH3 (ORCPT ); Wed, 29 Jun 2022 07:07:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230140AbiF2LHZ (ORCPT ); Wed, 29 Jun 2022 07:07:25 -0400 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42C3D3D4B4 for ; Wed, 29 Jun 2022 04:07:24 -0700 (PDT) Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id B923E41015 for ; Wed, 29 Jun 2022 11:07:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1656500842; bh=Rbk3h/ZyQTcA1nhbUwjo+czhYffJ6+LSq1adnjDE8t4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=vEMtHGMkTjYcfiF58KNfRoOUZsE6VJI38plBkCFW079KjbrAynKUtJubDr3aX7LLb cR54z0ImCVkojXQrAAYF82bRTXQ7Lo1OtvaeyMyj9p0w1lB9Zpi4LO7phD1NiZze2S fvEsesri5P3MNIhQRrsI58TsjoVEj3l8DtNr2NG0FeneSNxYemybX8tMiU8j1J0aNZ Ha4En7K8Hpd2L/EtxTq2JlymgHO4KJpPdrlcWm4Y5NCOYd0YyHuM5WzBnYoya9/W3i YibYiIacWUxgRD5lbN/BPtayOengkrGYzpxw3UYbk43nIg8qbvUsjQi6lNMe25LJmY tiMSbAWJjEvMQ== Received: by mail-ej1-f70.google.com with SMTP id qf29-20020a1709077f1d00b00722e68806c4so4748835ejc.4 for ; Wed, 29 Jun 2022 04:07:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Rbk3h/ZyQTcA1nhbUwjo+czhYffJ6+LSq1adnjDE8t4=; b=e7ZayPF3LgU07nzmuPp8U2tkFV9fjusAkuleNXmNEYcTQzauto3eY+59BcoFAbSnCo 12tjL9+hmJjRNTccWIuT7GUehL3v9P2K4WOoYAtR1VHSjf0zyNbvl6f9yqOZCndqLEzS /NqkJi0JFx10pgvp9Q4bXU4XKxM+bDu1fyeJNyBkHi49KbT4MGUdM9prouvbsIPspZ/u Qd2RDqBL3LLRNkFEJpaxxSHFotmCdkWkZcI0wqp8KPxjdtavaolL49pNYkvs285i70j4 AHmwQZa/MF5VHLjA0wVXnZMP8VxzW2VcZqTqy9KmPOOrzM4gdaqxoTI9SO8NEKR/ppYW 6y3Q== X-Gm-Message-State: AJIora9kh5Wwvlmvy877QO60jwPaSagUa/Lzllsz9M2e7QLjWZp4hHms 4bNMmgD1xjWEIj26T9VIqsEp5n3+fTj91n+UFm7avEEW0EdLkBEaHuDvp1jRJciyeTD72D9Hzj8 WVQ9PxswsGD4osQU58V1kkAGO1yS795GCoomHfj1SIIeN X-Received: by 2002:a05:6402:3909:b0:435:7a69:2cfd with SMTP id fe9-20020a056402390900b004357a692cfdmr3406353edb.166.1656500842003; Wed, 29 Jun 2022 04:07:22 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tThif8280wzXk6Ut9jXKYRnm02Yy/OjNEOJCEj1xRjX3WNRnkf7vJYfXD49sy7it1uTCKgpw== X-Received: by 2002:a05:6402:3909:b0:435:7a69:2cfd with SMTP id fe9-20020a056402390900b004357a692cfdmr3406323edb.166.1656500841846; Wed, 29 Jun 2022 04:07:21 -0700 (PDT) Received: from Isaac-Laptop.fritz.box ([2a02:908:672:1020:dd2a:5258:a4c9:43ea]) by smtp.gmail.com with ESMTPSA id r1-20020aa7cb81000000b004357b717a96sm11127630edt.85.2022.06.29.04.07.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jun 2022 04:07:21 -0700 (PDT) From: Isaac True To: linux-watchdog@vger.kernel.org Cc: devicetree@vger.kernel.org, wim@linux-watchdog.org, linux@roeck-us.net, Isaac True Subject: [PATCH 2/2] watchdog: gpio: add configurable minimum interval Date: Wed, 29 Jun 2022 13:06:26 +0200 Message-Id: <20220629110626.2158127-2-isaac.true@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220629110626.2158127-1-isaac.true@canonical.com> References: <20220629110626.2158127-1-isaac.true@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org Add the "min_hw_margin_ms" parameter to gpio_wdt devices, allowing a minimum interval to be specified, stopping watchdog devices from being fed too quickly if they require a certain interval between feeds. Signed-off-by: Isaac True --- drivers/watchdog/gpio_wdt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/watchdog/gpio_wdt.c b/drivers/watchdog/gpio_wdt.c index 0923201ce874..309f66536a14 100644 --- a/drivers/watchdog/gpio_wdt.c +++ b/drivers/watchdog/gpio_wdt.c @@ -110,6 +110,7 @@ static int gpio_wdt_probe(struct platform_device *pdev) struct gpio_wdt_priv *priv; enum gpiod_flags gflags; unsigned int hw_margin; + unsigned int min_hw_margin; const char *algo; int ret; @@ -144,6 +145,16 @@ static int gpio_wdt_probe(struct platform_device *pdev) if (hw_margin < 2 || hw_margin > 65535) return -EINVAL; + ret = of_property_read_u32(np, "min_hw_margin_ms", &min_hw_margin); + if (ret) + min_hw_margin = 0; + + if (min_hw_margin > hw_margin) { + dev_err(dev, + "Minimum interval cannot be greater than the watchdog interval"); + return -EINVAL; + } + priv->always_running = of_property_read_bool(np, "always-running"); @@ -152,6 +163,7 @@ static int gpio_wdt_probe(struct platform_device *pdev) priv->wdd.info = &gpio_wdt_ident; priv->wdd.ops = &gpio_wdt_ops; priv->wdd.min_timeout = SOFT_TIMEOUT_MIN; + priv->wdd.min_hw_heartbeat_ms = min_hw_margin; priv->wdd.max_hw_heartbeat_ms = hw_margin; priv->wdd.parent = dev; priv->wdd.timeout = SOFT_TIMEOUT_DEF;