From patchwork Thu Feb 1 15:58:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 768998 Received: from xavier.telenet-ops.be (xavier.telenet-ops.be [195.130.132.52]) (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 A66AB15DBBD for ; Thu, 1 Feb 2024 15:58:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.130.132.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706803130; cv=none; b=SPhbGkIOKo2taFVxlwz2BiRanlYRz+eBAHJTJxXkqf+9eStMZROQlIhc/gIo0CQPT9Rjd6AJC3KtdGyFNkkAgtX2etNQYrWzGkYMM6mbXndIeLMypfRNOhzkn/AMe09FqGhI0T6Afbh8v9m40ms79n2s5KtdZVQYkHaS7upYnqY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706803130; c=relaxed/simple; bh=psIvWV3hDRalSJpwlz2aPwOIlCQIQPngKO3nwLwfQhY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=sbkXgcuxrM+kF5HaSxWNJsaPe3JRjTdB837E8weaeH4TX+/Tv9TuLKNz9AmHnH3lh0omLchpqKjWzzWKcgnt9JkGrVfhAjcx5po/UMRGXIpAJvbHKagYH2iwiezEBOmWygEX7iCHtDprlY86d162GMqXyshgpXREv/K2qv1StFc= 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.132.52 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:ed40:4392:e888:3d14:1bdc]) by xavier.telenet-ops.be with bizsmtp id hryk2B0042BHJxj01ryk6F; Thu, 01 Feb 2024 16:58:45 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1rVZRn-00GvjW-2p; Thu, 01 Feb 2024 16:58:44 +0100 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1rVZSe-00Abua-2h; Thu, 01 Feb 2024 16:58:44 +0100 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 1/2] regulator: dt-bindings: gpio-regulator: Fix {gpios-,}states limits Date: Thu, 1 Feb 2024 16:58:41 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 make dtbs_check: arch/arm64/boot/dts/renesas/r8a77951-salvator-xs.dtb: regulator-vccq-sdhi0: Unevaluated properties are not allowed ('gpios-states', 'states' were unexpected) from schema $id: http://devicetree.org/schemas/regulator/gpio-regulator.yaml# The number of items in "gpios-states" must match the number of items in "gpios", so their limits should be identical. The number of items in "states" must lie within the range from zero up to 2^{number of gpios}. Signed-off-by: Geert Uytterhoeven --- The second issue did not cause any dtbs_check errors? --- .../devicetree/bindings/regulator/gpio-regulator.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/regulator/gpio-regulator.yaml b/Documentation/devicetree/bindings/regulator/gpio-regulator.yaml index f4c1f36e52e9c3d8..1cecf8faee5dc374 100644 --- a/Documentation/devicetree/bindings/regulator/gpio-regulator.yaml +++ b/Documentation/devicetree/bindings/regulator/gpio-regulator.yaml @@ -47,6 +47,7 @@ properties: 1: HIGH Default is LOW if nothing else is specified. $ref: /schemas/types.yaml#/definitions/uint32-array + minItems: 1 maxItems: 8 items: enum: [0, 1] @@ -57,7 +58,8 @@ properties: regulator and matching GPIO configurations to achieve them. If there are no states in the "states" array, use a fixed regulator instead. $ref: /schemas/types.yaml#/definitions/uint32-matrix - maxItems: 8 + minItems: 0 + maxItems: 256 items: items: - description: Voltage in microvolts From patchwork Thu Feb 1 15:58:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 768999 Received: from andre.telenet-ops.be (andre.telenet-ops.be [195.130.132.53]) (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 A761415DBBF for ; Thu, 1 Feb 2024 15:58:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.130.132.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706803129; cv=none; b=loJQfp1GAW13ZqVkcuN+oAKkHK0tm1g8H4zpmZ+os5fGB+Zi4N0awHFCMeKQB3Kt2zewKlXUISalLoVF8GtP33W/dk3u2F6snHqKtitgBibz3bgQUtN/dH8MCUd4//0Hhzu5QNSD4EMKKsE4NG/iRd/bDvdZAxKaU/q4bdbE3lE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706803129; c=relaxed/simple; bh=CF2ARHz2cRosX82RdwM2kdN6+Pv0jTsoPu/93EYZ5G8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=H4mKm5k9XLQBO+J7BgzyULzsLrJ5ZLlci32+bsTAtNn9PZjzlC7qwIfGHPu53rYKWUDSjBu9fU4X/DGrCsR0ErkLXaq1u88uJO5dDvRi4yFIUntIAqqNcncVUZ+gPyK87cWGE7wAnbMHqkKqkVapvmcbxkcPa/opQ1jtxejwTso= 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.132.53 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:ed40:4392:e888:3d14:1bdc]) by andre.telenet-ops.be with bizsmtp id hryk2B0072BHJxj01rykWw; Thu, 01 Feb 2024 16:58:45 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1rVZRn-00GvjY-3I; Thu, 01 Feb 2024 16:58:44 +0100 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1rVZSe-00Abud-3K; Thu, 01 Feb 2024 16:58:44 +0100 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 2/2] regulator: gpio: Correct default GPIO state to LOW Date: Thu, 1 Feb 2024 16:58:42 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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? --- 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;