Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3382593imu; Sun, 11 Nov 2018 13:46:34 -0800 (PST) X-Google-Smtp-Source: AJdET5dV9D3lsJSlzhCh1XZAZTeQCExYEagtlgJLGPZltZolEjakNMbqP78CuTlJ4Dxx8ucMpr2p X-Received: by 2002:a63:de4c:: with SMTP id y12mr15220009pgi.198.1541972794662; Sun, 11 Nov 2018 13:46:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541972794; cv=none; d=google.com; s=arc-20160816; b=H5di7ak9Qf9BGF/kCnRfYuoe+92vRci33IEVofQxY/E29EJl/3tTabKbmcWwARCscm 3uWjG4vvFqvn4vXuZt0yQI9TpN8v6noh9/ADeZxrVkm6stP0T9qs3DsV7sfuje3dHVz5 6IWsWxeZpIIG5VSbAC/7IfSJILuaEVmXgrmos6IJ+OfRnmy66zkOFMq9sFJLzmGev0sC z5W/O86leJzU57h8k+a0AKwQ2StIbu1lNhP5vjZR2BeWv0WEvRrqfcQyG64Sedrlscck e3OJ4ZUZWliOR/nY5cHHPKJ8iYyhRUh/hGc4uucLMF5BiijgjA4gUmDPKB2/S2jKJpch fqCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=J3Jj1wLNqkjNnu/XVlQhlBcST2YXK2RN6nxtcDvNfF4=; b=dXkR5aLRKUf8oqrBSL9aUU2MGqxLExX6hKgd/SJT6tbJXA7fIHE8Nk6GcAcxqgw+Qd g3zqbIVktrzaasec5TIFEiTvJp+Xi0XwIu/jcP1+G90UhKF9tGYi7YgU13W0lXlPQ5sk DS+JCQZyV2qKJaZqUmJucPMDpUqhF5SwKLv0tWXeHgCYlwPjWWJ/ckjOZXwqNNIg5KCd gXJ8QlXkrNX6klTbqC5usD1Cfa3ENGqkx1zP2J+RqKHMH16BdKk9nXSW5AJw48vXzx6A wD/wpcgSBGJdpcH0nLVJl1MVnVh03He731KAyrtnfSsb6xAOgDPZYCj6QtA8fkRY6CSc Vw/w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 22si14488811pgr.356.2018.11.11.13.46.19; Sun, 11 Nov 2018 13:46:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729596AbeKLHff (ORCPT + 99 others); Mon, 12 Nov 2018 02:35:35 -0500 Received: from gloria.sntech.de ([185.11.138.130]:44476 "EHLO gloria.sntech.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726678AbeKLHff (ORCPT ); Mon, 12 Nov 2018 02:35:35 -0500 Received: from p54b264b4.dip0.t-ipconnect.de ([84.178.100.180] helo=phil.fritz.box) by gloria.sntech.de with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1gLxY9-0001lw-7x; Sun, 11 Nov 2018 22:45:45 +0100 From: Heiko Stuebner To: sre@kernel.org Cc: robh+dt@kernel.org, mark.rutland@arm.com, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, mdf@kernel.org, heiko@sntech.de, Heiko Stuebner Subject: [PATCH] power: reset: gpio-poweroff: add ability to specific active and inactive delays Date: Sun, 11 Nov 2018 22:45:38 +0100 Message-Id: <20181111214538.32477-1-heiko@sntech.de> X-Mailer: git-send-email 2.18.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Heiko Stuebner Similar to gpio-reset allow to specify active and inactive delays while keeping the 100ms defaults that were used previously all the time. The dt-properties are named the same as in gpio-reset but get an "-ms" suffix as properties should contain such a suffix specifying its unit. Signed-off-by: Heiko Stuebner --- .../devicetree/bindings/power/reset/gpio-poweroff.txt | 2 ++ drivers/power/reset/gpio-poweroff.c | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/power/reset/gpio-poweroff.txt b/Documentation/devicetree/bindings/power/reset/gpio-poweroff.txt index 6d8980c18c34..3e56c1b34a4c 100644 --- a/Documentation/devicetree/bindings/power/reset/gpio-poweroff.txt +++ b/Documentation/devicetree/bindings/power/reset/gpio-poweroff.txt @@ -27,6 +27,8 @@ Optional properties: it to an output when the power-off handler is called. If this optional property is not specified, the GPIO is initialized as an output in its inactive state. +- active-delay-ms: Delay (default 100) to wait after driving gpio active +- inactive-delay-ms: Delay (default 100) to wait after driving gpio inactive - timeout-ms: Time to wait before asserting a WARN_ON(1). If nothing is specified, 3000 ms is used. diff --git a/drivers/power/reset/gpio-poweroff.c b/drivers/power/reset/gpio-poweroff.c index 38206c39b3bf..52525b6c18db 100644 --- a/drivers/power/reset/gpio-poweroff.c +++ b/drivers/power/reset/gpio-poweroff.c @@ -26,6 +26,8 @@ */ static struct gpio_desc *reset_gpio; static u32 timeout = DEFAULT_TIMEOUT_MS; +static u32 active_delay = 100; +static u32 inactive_delay = 100; static void gpio_poweroff_do_poweroff(void) { @@ -33,10 +35,11 @@ static void gpio_poweroff_do_poweroff(void) /* drive it active, also inactive->active edge */ gpiod_direction_output(reset_gpio, 1); - mdelay(100); + mdelay(active_delay); + /* drive inactive, also active->inactive edge */ gpiod_set_value_cansleep(reset_gpio, 0); - mdelay(100); + mdelay(inactive_delay); /* drive it active, also inactive->active edge */ gpiod_set_value_cansleep(reset_gpio, 1); @@ -66,6 +69,9 @@ static int gpio_poweroff_probe(struct platform_device *pdev) else flags = GPIOD_OUT_LOW; + device_property_read_u32(&pdev->dev, "active-delay-ms", &active_delay); + device_property_read_u32(&pdev->dev, "inactive-delay-ms", + &inactive_delay); device_property_read_u32(&pdev->dev, "timeout-ms", &timeout); reset_gpio = devm_gpiod_get(&pdev->dev, NULL, flags); -- 2.18.0