Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp518600lqb; Wed, 29 May 2024 02:50:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXzh06/VOMO3z9o86VEGuVLA5+oJrmP60TxANarohejVd5qr60GqWJHYgFkTLVGj1lBCFbTclqLsKKLpGb817EHTtd+uZnT7GZSeRDDGQ== X-Google-Smtp-Source: AGHT+IFyRz0IEs51Ho5V16rOv0uoYaX6+o2s4ScT2pnMzS4AMMdjX1XdNRztbHB1SmuLTRzG6eaZ X-Received: by 2002:a05:620a:535e:b0:794:9ec2:7a2d with SMTP id af79cd13be357-794ab05cd13mr1508676585a.6.1716976224984; Wed, 29 May 2024 02:50:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716976224; cv=pass; d=google.com; s=arc-20160816; b=nSC3eqKYNpdpO0CKAzLAxXia26S9wcJfMbWPze/cf0VL0pgD4jVco0n7PgR0sMHSIQ MWdpRWPIKPmX7tmPKBPE6bp4mwX+/mk6QNq5i7on/VnP3Y5j/BEWR6wKWAC6hr9W1JNr 2KbJ88pnQu8jd2GmWr6S4FQCdIeoZxTsYKy0Z4n56a3bfUv3Cy/lA8ocLWl4VIP64tVF m4uaD8EeAZHlcmBS+7XG8XRxgcmAIwCyaxFeHnbsEHDnFz3y8kSYN8lLMyl0hg5cefu6 71i+EGAYebR6EQLwaKmCRs+4dj2M+PqkLeO1sKTfqYixRRx3XX+FEz1VtudRMmCC0bxW a3xQ== 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:message-id:date:subject:cc:to :from; bh=hVUdf6ablZ73vunjohRmIYBEOuUtRRfMEjbPc2mhSVU=; fh=RgdF5unPf29wvTbw7yZQO98ygcSvQ5Ok9FPC1ido7Nw=; b=BlP+RQ8E/diHsQqkVCmc+O/Y0PX84HuGnmNSbXF9AooC4zbUcU2Yhr+7nh2byhEqdK 6o5oiHn21n7JBUXaz8mO1lPAQrKCkboOBHkL1Dy9y3nOmH1KhfcuCN5qvB7bwID5cSqA zw9iyXCCTO+aMYxSFaBFfyjezFY1RAN17nmhQbEKEwj798OZ/loPqeeDSzteCmGnGYZD MM8vfj0ngUZr9sl8ZdIGSPLQlFQuKSW7HFakFPyrQqz2vDFat5bRS4xMLgAYCzTP1ULd i4giz1g05y1RkzSazCs0kPoaIHc1ybVA9qGfU4XDofwHe3ZzpvJsqf1voQ+N0pf7eRje bihA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-193885-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-193885-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-794abcab7e9si1222786785a.39.2024.05.29.02.50.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 02:50:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-193885-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-193885-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-193885-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id B48C51C2299C for ; Wed, 29 May 2024 09:50:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0EC0416EC02; Wed, 29 May 2024 09:49:58 +0000 (UTC) Received: from laurent.telenet-ops.be (laurent.telenet-ops.be [195.130.137.89]) (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 CD5EC16E89F for ; Wed, 29 May 2024 09:49:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.130.137.89 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716976197; cv=none; b=WAokNcdnVM5JlE9tVrjyhE4rnzBx8HT5MRsdodZtpj2O5FbLv1srG0HR5rVK46Zk6oiHl4zWQjTIwlClYWxJtZbJcWKu+0Vp5VJqSgDiDAdhkfrwEcjEMCE68E7bJ5bAeeuyFP8cD1ACFx79Z8AQB+tstRVQ2fU1NeIyVx8SQGg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716976197; c=relaxed/simple; bh=3xeT2DhUhqJQwOqvnLicYhAeyGJj28gG9xrLyTarXVA=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=KgxNXvmWSPKUlo2+XOndX88Uq71qyTcv6DQk4WX+B0fuX6gdBOKJdXL5csufSkwnUeL7zmlgoV+7XmBKEbuJ47WhBylcaSbtiN8tM4trRJbTiZ/uQZjhtieHQA6cS7I18yVtqSEqWXhbmSXY7c+AMYmYR+30v/9boWIwlBHzvVc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be; spf=none smtp.mailfrom=linux-m68k.org; arc=none smtp.client-ip=195.130.137.89 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux-m68k.org Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed80:1b01:1838:131c:4de4]) by laurent.telenet-ops.be with bizsmtp id Uxps2C00A3VPV9V01xpsY1; Wed, 29 May 2024 11:49:53 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1sCFvR-00GJsN-PV; Wed, 29 May 2024 11:49:52 +0200 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1sCFwO-008wnD-50; Wed, 29 May 2024 11:49:52 +0200 From: Geert Uytterhoeven To: Liam Girdwood , Mark Brown , Linus Walleij , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Marek Szyprowski Cc: devicetree@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2] regulator: gpio: Correct default GPIO state to LOW Date: Wed, 29 May 2024 11:49:51 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit According to the GPIO regulator DT bindings[1], the default GPIO state is LOW. However, the driver defaults to HIGH. Before the conversion to descriptors in commit d6cd33ad71029a3f ("regulator: gpio: Convert to use descriptors"), the default state used by the driver was rather ill-defined, too: - If the "gpio-states" property was missing or empty, the default was low, matching the bindings. - If the "gpio-states" property was present, the default for missing entries was the value of the last present entry. Fix this by making the driver adhere to the DT bindings, i.e. default to LOW. [1] Documentation/devicetree/bindings/regulator/gpio-regulator.yaml Signed-off-by: Geert Uytterhoeven Acked-by: Linus Walleij --- I have no idea if this has any impact. I guess most/all DTS files have proper gpios-states properties? v2: - Add Acked-by. --- drivers/regulator/gpio-regulator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/regulator/gpio-regulator.c b/drivers/regulator/gpio-regulator.c index 65927fa2ef161cda..5dfed8bae0c4cfdc 100644 --- a/drivers/regulator/gpio-regulator.c +++ b/drivers/regulator/gpio-regulator.c @@ -176,9 +176,9 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np, ret = of_property_read_u32_index(np, "gpios-states", i, &val); - /* Default to high per specification */ + /* Default to low per specification */ if (ret) - config->gflags[i] = GPIOD_OUT_HIGH; + config->gflags[i] = GPIOD_OUT_LOW; else config->gflags[i] = val ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW; -- 2.34.1