From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FAFDC43381 for ; Wed, 6 Mar 2019 21:56:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5052B20663 for ; Wed, 6 Mar 2019 21:56:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IAjD1p/Y" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726111AbfCFV4y (ORCPT ); Wed, 6 Mar 2019 16:56:54 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:51929 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725790AbfCFV4x (ORCPT ); Wed, 6 Mar 2019 16:56:53 -0500 Received: by mail-wm1-f67.google.com with SMTP id n19so7374581wmi.1; Wed, 06 Mar 2019 13:56:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:openpgp:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Pk4oMuzUc9FlexbFs78UCW8bO7TDoIekFf7NjKNLv5M=; b=IAjD1p/YYCZWLxngWEY7Lcn7mNxNHlce6wfAsSUOYcB/vlrJGfPPnygrrYyBnUyVL9 JO1CBYUbNmfOfsSddMIzXmFywlxpb8hXhW94NK0Mv754NRTMChqH/1CTyubthHPHeQfU k9KPiC64i7n+hnqvlXN5TYZgL8hc51DPj4wPdQ1plywHgDT27nXRnDtPdfEq2az8PjZM setJ8MLtqYU2267F+dN90pdpa8O9b1jqDZ5gIRrh5HbLGKnlNfJcUkkg2cor+rhKl3z7 hV0yWdeylPKh22L6d9yiGvD5dPLyFBJ2j2cZ36YRjYyUqhVcl2i1//jcUtMfHvUt4XCO ZGlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Pk4oMuzUc9FlexbFs78UCW8bO7TDoIekFf7NjKNLv5M=; b=i3y/x+nD6tFgT9jpPoIuifOb1pH2+TUpqmj6nBXkvj9gaTvW8eUmBCICgBcUPapDdP noi02NWLjHNnIaLOo2UuuAi3PJVyiNydlCsFSpGyURXGcEeFJ3amTawXkicYwAHwpBje Rko5zDIrL4ZT+XPCWeEO2vNrkORDLcpXL6Yqwj5My2vcyFO7iNjJK7ARtCVqr9QMbJvj 3ckrcIAYTe3A/CK538utvBFsJ2k0eGXjQ0JGCoSmArNk92yAVPZk4wsvS+Ns/BHHmwdX NIMiRjbiEbXtYOHkN8AhDqgnbx5FZZs7XnRjqxB68t+h8/qm0FGBLP048lltazHQybsH CfNQ== X-Gm-Message-State: APjAAAWfyuqWdjHVcdQZUIO6pi6zILA3gkq1UXEUyOkCjP/O396wmHeo UrYuz2ZbeFD6pVg7edkFRn+bRsp+ X-Google-Smtp-Source: APXvYqwLzmH5jubr0dswEK+py+uVe1KRKenjTUD2dup5EwbKlyZXKvlEcY8B9O60epdT73S4xA4E7g== X-Received: by 2002:a7b:cf27:: with SMTP id m7mr3659084wmg.80.1551909410951; Wed, 06 Mar 2019 13:56:50 -0800 (PST) Received: from [192.168.1.4] (ip-86-49-110-70.net.upcbroadband.cz. [86.49.110.70]) by smtp.gmail.com with ESMTPSA id a1sm4233625wrq.96.2019.03.06.13.56.49 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Wed, 06 Mar 2019 13:56:50 -0800 (PST) Subject: Re: [PATCH V2] regulator: gpio: Reword the binding document To: Harald Geyer Cc: devicetree@vger.kernel.org, Marek Vasut , Kuninori Morimoto , Linus Walleij , Mark Brown , Rob Herring , linux-renesas-soc@vger.kernel.org References: <20190304194023.10926-1-marek.vasut@gmail.com> <834f8576-73a4-be0f-e322-91601bed5388@gmail.com> <4d1cd905-c322-78e5-cb9c-dadba01b0324@gmail.com> <89743562-bb2a-de3f-a57b-331f43bf8982@gmail.com> From: Marek Vasut Openpgp: preference=signencrypt Message-ID: <96fe2cd4-c680-31c9-98f2-31a400e6c44b@gmail.com> Date: Wed, 6 Mar 2019 22:56:35 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org On 3/6/19 9:17 AM, Harald Geyer wrote: > Marek Vasut writes: >> On 3/5/19 10:36 PM, Harald Geyer wrote: >>> Marek Vasut writes: >>>> On 3/5/19 5:10 PM, Harald Geyer wrote: >>>>> Marek Vasut writes: >>>>>> On 3/5/19 11:07 AM, Harald Geyer wrote: >>>>>>> marek.vasut@gmail.com writes: >>>>>>>> From: Marek Vasut >>>>>>>> >>>>>>>> Reword the binding document to make it clear how the propeties work >>>>>>>> and which properties affect which other properties. >>>>>>>> >>>>>>>> Signed-off-by: Marek Vasut >>>>>>>> Cc: Harald Geyer >>>>>>>> Cc: Kuninori Morimoto >>>>>>>> Cc: Linus Walleij >>>>>>>> Cc: Mark Brown >>>>>>>> Cc: Rob Herring >>>>>>>> Cc: linux-renesas-soc@vger.kernel.org >>>>>>>> To: devicetree@vger.kernel.org >>>>>>>> --- >>>>>>>> V2: - Make "gpios" a mandatory property >>>>>>>> - Reword "gpio-states" property description >>>>>>>> - Change "enable-gpio" to "enable-gpios" to match modern DT rules >>>>>>>> Note: The recent gpio-regulator rework caused breakage. While the >>>>>>>> changes in the gpio-regulator code were according to the DT >>>>>>>> binding document, they stopped working with older DTs. Make >>>>>>>> the binding document clearer to prevent such breakage in the >>>>>>>> future. >>>>>>> >>>>>>> Thanks for the update. I think it addresses all my concerns except for >>>>>>> one: >>>>>>> >>>>>>>> +- gpios-states : State of GPIO pins in "gpios" array that is set until >>>>>>>> + changed by the first consumer. 0: LOW, 1: HIGH. >>>>>>>> + Default is LOW if nothing else is specified. >>>>>>> >>>>>>> I still believe this not true: There is no guarantee that the regulator >>>>>>> core won't change the state of GPIO pins before the first consumer comes >>>>>>> up. >>>>>> >>>>>> Why would it do that ? >>>>> >>>>> Because the regulator core doesn't know about this driver specific >>>>> property at all. And without any constraints placed by consumers, the >>>>> core is free to choose any state whatsoever at any point in time. >>>> >>>> But git grep seems to disagree, see drivers/regulator/gpio-regulator.c: >>>> ret = of_property_read_u32_index(np, "gpios-states", i, >>>> >>>> The core sets the pins to such a value until the consumer takes over. >>> >>> I think we have a misunderstanding of terminology. When I write "regulator >>> core", I mean the driver independent regulator code. The line you quote >>> above is part of the gpio-regulator driver and thus not part of what >>> I call the "regulator core". >>> >>> AFAICS the data from the property is only stored in a driver specific >>> data structure (and not used at all outside of probe) but never passed >>> to what I call the regulator core. >>> >>> Why do you believe there is a guarantee that the value set during >>> probeing is preserved until a consumer takes over? >> >> It is the only sensible behavior and the behavior I see people expect >> from this property. I presume it solidified in this sort of semi-defined >> state, so we're stuck with assuming it behaves this way to maintain >> compatibility. > > Maybe the behaviour you want would be more sensible, but AFAIK it just > isn't true in general (it might work that way by chance in many cases). > If people expect this behaviour, it is a misunderstanding of the old wording. > I'd prefer we don't have to add a quirk to the regulator subsystem to > cater for a misunderstanding. > > I think, if you really want to go forward with making this behaviour > officially maintained, then we should first add the code to linux and > only then add the promise to the binding document. This isn't the scope > of this patch, so I guess we would need to keep the ambiguous wording as > it is for now. I believe it is more important for a binding document > to be correct than to be sensible. > > However I don't think we actually need to go to such extremes: In linux > we currently have (arm/boot/dts and arm64/boot/dts) 38 uses of this > property in 29 DTs. All the examples, that I studied in some detail, > seem to either don't need this property at all or have a usecase that is > supported by my proposed wording. I don't expect any problems if we just > document the status quo clearly. In that case, provide a suggestion how to document this property better? -- Best regards, Marek Vasut