From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756242AbbIVIhN (ORCPT ); Tue, 22 Sep 2015 04:37:13 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:59791 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751657AbbIVIhH (ORCPT ); Tue, 22 Sep 2015 04:37:07 -0400 From: Arnd Bergmann To: Constantine Shulyupin , Jean Delvare Cc: open list , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Guenter Roeck , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala Subject: Re: Please suggest proper format for DT properties. Date: Tue, 22 Sep 2015 10:36:51 +0200 Message-ID: <3914149.k3sqApaTEz@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <1442615803-17766-1-git-send-email-const@MakeLinux.com> References: <1442615803-17766-1-git-send-email-const@MakeLinux.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:z4m/mQaKgIXm04eqrjPrRVS5uX2BG4vNLGqrWL6pG9SeCGi88JF A87RbPD7jz7ybw5nfQBFI+yXFaKpKmhLdhE1KYkqMK69nCf3qYBkQUcfafPV21GKKiQvqrb 8fUTEsgHuT56+uF4bShqg261i8Rb/zaFCkMUjE7xobD+K2gy6hSRwnCMi0CCgWoERBTQmN5 4v2J3zMUbDoDADc4uZoyg== X-UI-Out-Filterresults: notjunk:1;V01:K0:kTI3Ns2OJ1w=:iLg9MhMEBrl3dYd4WlYlwP IPLbkoEaGlpAzXunC6km79rvWxs1CRbN3ERugtNTa2dMFUqI+RkrAoe0m4bYEbzSr4muNDIsb QSZrNFurmo5nlO5hoHwkewKgAARmAHfFSdf0ww6DgSUB8xPlvDIJ22xcfiGefHgGPuuAjXfMN icM0fooufvjIowr5JtZZA01xJntN+hV44aHiMqxW+4c9Pg5hQszvBfC12jx8/GugereD9Qknf ynuDIXeiWDN9lt6ARAf09wYfebT2MgXajGh2YPbSCp/Y9BJHQyYQY+vCDoFVOMKUEnQj8w6j8 k+HJgs5ZeY2HtlRUYpzmVbwyFCKr3N0Zb44hh4jmzDDxSqcmPC/EaX1pVMvMrKE/nGGyvF0z4 IEYOPwdRCwJ780ROUJxrEX6Xc/9b2yVXvfGW4Wo2jIZ2E4nvixFfxwVz9C5Q++YubgNtco3hB LpWJi+uRtDty1FExcr7hMIggeghRIkF0ro6AE4RF0fjUwl85/8d+rSguNE/j8PHQMMAvTsn3I MAmuRaEnT6WIaI1GceEBOiJg7lSn+yzetJKOKIXe3Z08jgCUeJwWJg/16GZUTNVuh1F1YKLgj HaPgmR63ztD8CvhdX5eOJF78ui7fc3rMP51irLiWMrIozhXTrzUO6pXzh6Rl5B6/O3+APRNf0 +fp1QUHbunhzzckKfISag9fMZaohspAV83p4iDtBqdbbbw6ASiai9pRGKYeipIZ/UJmYWvUFG umNuvPjYnLzxdwYd Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Saturday 19 September 2015 01:36:43 Constantine Shulyupin wrote: > > I am designing DT support for a hwmon chip. > It has some sensors, each of them can be: > - "disabled" > - "thermal diode" > - "thermistor" > - "voltage" > > Four possible options for DT properties format. > > Option 1: Separated property for each sensor. > > Example nct7802 node: > > nct7802 { > compatible = "nuvoton,nct7802"; > reg = <0x2a>; > nuvoton,sensor1-type = "thermistor"; > nuvoton,sensor2-type = "disabled"; > nuvoton,sensor3-type = "voltage"; > }; > > Option 2: Array of strings for all sensors. > > nct7802 { > compatible = "nuvoton,nct7802"; > reg = <0x2a>; > nuvoton,sensors-types = "thermistor", "disabled", "voltage"; > }; > > Option 3: Sets of 4 cells. > > Borrowed from marvell,reg-init and broadcom,c45-reg-init. > > The first cell is the page address, > the second a register address within the page, > the third cell contains a mask to be ANDed with the existing register > value, and the fourth cell is ORed with the result to yield the > new register value. If the third cell has a value of zero, > no read of the existing value is performed. > > Example nct7802 node: > > nct7802 { > compatible = "nuvoton,nct7802"; > reg = <0x2a>; > nct7802,reg-init = > <0 0x21 0 0x01 > // START = 1 > <0 0x22 0x03 0x02>; // RTD1_MD = 2 > }; > I would strongly prefer Option 1 or 2 over option 3. Between 1 and 2, I'd probably go for 1. Another option might be to have a subnode per sensor: nct7802@2a { compatible = "nuvoton,nct7802"; reg = <0x2a>; #address-cells=<1>; #size-cells=<0>; sensor@1 { compatible = "nuvoton,nct7802-thermistor"; further-properties; }; sensor@3 { compatible = "nuvoton,nct7802-voltage"; for-example-range-mv = <0 5000>; }; }; In either case, I'd say that disabled sensors should not need to be listed. Arnd