From nobody Fri Jun 19 15:56:20 2026 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 A0360C433F5 for ; Fri, 1 Apr 2022 16:20:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343505AbiDAQVy (ORCPT ); Fri, 1 Apr 2022 12:21:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353012AbiDAQSa (ORCPT ); Fri, 1 Apr 2022 12:18:30 -0400 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56DEA20A3A2 for ; Fri, 1 Apr 2022 08:42:45 -0700 (PDT) Received: by mail-ej1-x631.google.com with SMTP id dr20so6647876ejc.6 for ; Fri, 01 Apr 2022 08:42:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lvLYetfC0M8ee2ZpgnCvvT8BGE0UJGsuIlJ++425c5Q=; b=PJLevIDANrLODu8fBXwyylwK97oTmcegFajjWWGAZOm7niuglbhgOpzthyJV4IGp01 aN9FM2b/uD2BS4esIiMsfm1CDjdsxhppDuCcAoJiv+jcRWMSt3Yim5gpcx9sAoTOpsr4 3jU4aKR965lWuxySpybk6bQjcsLq0orOa9I2KhhwMy8WC1Wt1IMmumuocBuAbuIFPrEQ KFXwtaS5EbO81nVg4AOEb09BpAaEMBYwlxBLE1DmGhFagM839RjR/7c3dAJU4QEwJ2cW ToJ3JOkX5w5b4fGpxixqtINo7nMiZcgf2XK6PIsWHmwujtQqciUrbKlnwehnyVTsaTTi aUag== 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=lvLYetfC0M8ee2ZpgnCvvT8BGE0UJGsuIlJ++425c5Q=; b=ikrAABB8Q+E7446UijyBV3X5wdi/oTNaph15leox/ZdxqyoUMq1KVgNNxloBh7DFzD D3LzySVkCKb7NI4HAJulzUDYH4f+bVDtuQOyDU2dTdAdNEroMiJK7sbZ3VqPzsz09Fp+ ZV0LeeY9uKIQab3ANb8dZyGYB98bKYrIoCl0CnYUO92hDHfSg/juW9/qQSlbHSG/ukud H7SWbIwjyVARfU3Hu86cr/zKjQeiAM4nxh8xZJ0zK/RTuK/W3WxHsZoPBtlfFvfhNfjB +xli/5hfotM9LJs/YYtNuZPcj5vLkl65y/lUHpqH6Sd4NaUY1WUZsYN0iibPkt2p+PP/ /rvQ== X-Gm-Message-State: AOAM532DXDyaT9c/kF1r1pGC8lYS4KdUs49S69DEf0KQFQEhSpHEk9u3 7PLpcyaUc5OppiyoBJqKkFH3cA== X-Google-Smtp-Source: ABdhPJx4V0qZLEwhvDCy4+cT0n9AkXUO/yzATDyh4tBTtpxZS5WH0DrunhCmOHIu7kIIBGw3uJgdug== X-Received: by 2002:a17:907:270a:b0:6e4:86a4:9b09 with SMTP id w10-20020a170907270a00b006e486a49b09mr354177ejk.23.1648827763561; Fri, 01 Apr 2022 08:42:43 -0700 (PDT) Received: from localhost.localdomain (xdsl-188-155-201-27.adslplus.ch. [188.155.201.27]) by smtp.gmail.com with ESMTPSA id k12-20020aa7c38c000000b0041939d9ccd0sm1300389edq.81.2022.04.01.08.42.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Apr 2022 08:42:43 -0700 (PDT) From: Krzysztof Kozlowski To: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , ChiYuan Huang , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [RFT PATCH 1/2] regulator: dt-bindings: richtek,rt4801: use existing ena_gpiod feature Date: Fri, 1 Apr 2022 17:42:36 +0200 Message-Id: <20220401154237.1061331-2-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220401154237.1061331-1-krzysztof.kozlowski@linaro.org> References: <20220401154237.1061331-1-krzysztof.kozlowski@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The binding and driver duplicated regulator core feature of controlling regulators with GPIOs (of_parse_cb + ena_gpiod) and created its own enable-gpios property with multiple GPIOs. This is a less preferred way, because enable-gpios should enable only one element, not multiple. It also duplicates existing solution. Deprecate the original 'enable-gpios' and add per-regulator property. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Rob Herring --- .../regulator/richtek,rt4801-regulator.yaml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/regulator/richtek,rt4801-reg= ulator.yaml b/Documentation/devicetree/bindings/regulator/richtek,rt4801-re= gulator.yaml index 4a4dfa7d9d09..091150c4e579 100644 --- a/Documentation/devicetree/bindings/regulator/richtek,rt4801-regulator.= yaml +++ b/Documentation/devicetree/bindings/regulator/richtek,rt4801-regulator.= yaml @@ -32,8 +32,11 @@ properties: If only one gpio is specified, only one gpio used to control ENP/ENM. Else if both are specified, DSVP/DSVN could be controlled individual= ly. If this property not specified, treat both as always-on regulators. + + Property is deprecated. Use enable-gpios in each regulator. minItems: 1 maxItems: 2 + deprecated: true =20 patternProperties: "^DSV(P|N)$": @@ -42,6 +45,14 @@ patternProperties: description: Properties for single display bias regulator. =20 + properties: + enable-gpios: + description: + GPIO to use to enable DSVP/DSVN regulator. One GPIO can be confi= gured + for controlling both regulators. If this property not specified= for + any regulator, treat both as always-on regulators. + maxItems: 1 + required: - compatible - reg @@ -57,19 +68,20 @@ examples: rt4801@73 { compatible =3D "richtek,rt4801"; reg =3D <0x73>; - enable-gpios =3D <&gpio26 2 0>, <&gpio26 3 0>; =20 dsvp: DSVP { regulator-name =3D "rt4801,dsvp"; regulator-min-microvolt =3D <4000000>; regulator-max-microvolt =3D <6000000>; regulator-boot-on; + enable-gpios =3D <&gpio26 2 0>; }; dsvn: DSVN { regulator-name =3D "rt4801,dsvn"; regulator-min-microvolt =3D <4000000>; regulator-max-microvolt =3D <6000000>; regulator-boot-on; + enable-gpios =3D <&gpio26 3 0>; }; =20 }; --=20 2.32.0 From nobody Fri Jun 19 15:56:20 2026 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 EC227C43217 for ; Fri, 1 Apr 2022 16:19:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235968AbiDAQVc (ORCPT ); Fri, 1 Apr 2022 12:21:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353039AbiDAQSb (ORCPT ); Fri, 1 Apr 2022 12:18:31 -0400 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E21C160444 for ; Fri, 1 Apr 2022 08:42:49 -0700 (PDT) Received: by mail-ed1-x535.google.com with SMTP id w25so3396938edi.11 for ; Fri, 01 Apr 2022 08:42:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2QTzX8NPjEsC6DS75wIUIMoC9k1vEC4KyMC77JEhWDI=; b=ZwrA4adlvd2jCKD+i2qTWQ+0Q+XRKQFMEpNXkQuuaaIBGVDtcTE5BG6R8bw+4A/T5K z7FBj3jQO5clDqB8kO9ADJvJmOe7l3++ImLeqcXCg/Dg1Y2vyF5Exj1duWxm+LRaf/Ar sSSDC2il/RbQn4SUibUh9YMUrEOhGnEaX7ppeY4sLFz83nPBDl5/ho8zJRuORN6QST6Y EWJWb6OKinyk1m/qH9NF9YLX97cM5Owfa8/c/qNMctYHjXHwEoGzAqR/ymNbvJqUxvrB pPFPTmeHZnht3QcelJ7yIF1Z1lZcyWuwlUtnuyUpMJBJ2l7cAGaTiJOzixiONP7t9sbn cbAw== 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=2QTzX8NPjEsC6DS75wIUIMoC9k1vEC4KyMC77JEhWDI=; b=g1DQ+j5E6MSH1YPcbEx+r/y+bncXdsI+UUqvs5xAeSTn5SOrnayqOBE2aKxsasPfGQ NQJRDZlQvuV7KWYhTOFPFvlwGa1FMc9k7hIzjM+yO2RAmMI4toWprcCQrmUjQhZz69AD HEvx9sui8b6sYajwmb+Z8iIbByhcuaK93IYDeohXRQqSLzIhqGTE4icuj2cQ9jYttHU1 /3TwPUZ0jSnXGMWK70eSkVDhEc7Qq5RHrQRj6UQd6SzQkIuDWdLH/Yi7SHZtCJavE5tY wJtFMw0dMDBHPxGTKMdBx+alhCehvP8e3SP+tW0Da+RyaB6cpgCQ3J5fOjxPIoL4reWh JSzA== X-Gm-Message-State: AOAM531D35WAzbbJnBrflxTRna7W9gk3Jk9Lx2ZxoAbxOhNIWBlLEdvc qEhogwh6seDu/heNoEM/T6G69g== X-Google-Smtp-Source: ABdhPJz4QLYcHdtlV6CyLehrbFSvfS4BABdJhNxxEnOBbddowD6iYsBt3lWTTfhts8yTv0s23ycmog== X-Received: by 2002:a50:ab16:0:b0:414:39b0:7fc1 with SMTP id s22-20020a50ab16000000b0041439b07fc1mr21423933edc.214.1648827764784; Fri, 01 Apr 2022 08:42:44 -0700 (PDT) Received: from localhost.localdomain (xdsl-188-155-201-27.adslplus.ch. [188.155.201.27]) by smtp.gmail.com with ESMTPSA id k12-20020aa7c38c000000b0041939d9ccd0sm1300389edq.81.2022.04.01.08.42.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Apr 2022 08:42:44 -0700 (PDT) From: Krzysztof Kozlowski To: Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , ChiYuan Huang , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [RFT PATCH 2/2] regulator: richtek,rt4801: use existing ena_gpiod feature Date: Fri, 1 Apr 2022 17:42:37 +0200 Message-Id: <20220401154237.1061331-3-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220401154237.1061331-1-krzysztof.kozlowski@linaro.org> References: <20220401154237.1061331-1-krzysztof.kozlowski@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The driver duplicated regulator core feature of controlling regulators with GPIOs (of_parse_cb + ena_gpiod) and created its own enable-gpios property with multiple GPIOs. The core already does it. Keep old method for backwards compatibility. Signed-off-by: Krzysztof Kozlowski --- drivers/regulator/rt4801-regulator.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/regulator/rt4801-regulator.c b/drivers/regulator/rt480= 1-regulator.c index 7a87788d3f09..9d88b7858a21 100644 --- a/drivers/regulator/rt4801-regulator.c +++ b/drivers/regulator/rt4801-regulator.c @@ -34,6 +34,28 @@ struct rt4801_priv { unsigned int volt_sel[DSV_OUT_MAX]; }; =20 +static int rt4801_of_parse_cb(struct device_node *np, + const struct regulator_desc *desc, + struct regulator_config *config) +{ + struct rt4801_priv *priv =3D config->driver_data; + + if (priv->enable_gpios) { + dev_warn(priv->dev, "duplicated enable-gpios property\n"); + return 0; + } + config->ena_gpiod =3D fwnode_gpiod_get_index(of_fwnode_handle(np), + "enable-gpios", + 0, + GPIOD_OUT_HIGH | + GPIOD_FLAGS_BIT_NONEXCLUSIVE, + "rt4801"); + if (IS_ERR(config->ena_gpiod)) + config->ena_gpiod =3D NULL; + + return 0; +} + static int rt4801_set_voltage_sel(struct regulator_dev *rdev, unsigned int= selector) { struct rt4801_priv *priv =3D rdev_get_drvdata(rdev); @@ -122,6 +144,7 @@ static const struct regulator_desc rt4801_regulator_des= cs[] =3D { .name =3D "DSVP", .ops =3D &rt4801_regulator_ops, .of_match =3D of_match_ptr("DSVP"), + .of_parse_cb =3D rt4801_of_parse_cb, .type =3D REGULATOR_VOLTAGE, .id =3D DSV_OUT_POS, .min_uV =3D MIN_UV, @@ -135,6 +158,7 @@ static const struct regulator_desc rt4801_regulator_des= cs[] =3D { .name =3D "DSVN", .ops =3D &rt4801_regulator_ops, .of_match =3D of_match_ptr("DSVN"), + .of_parse_cb =3D rt4801_of_parse_cb, .type =3D REGULATOR_VOLTAGE, .id =3D DSV_OUT_NEG, .min_uV =3D MIN_UV, --=20 2.32.0