Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3221152ybb; Mon, 6 Apr 2020 04:46:11 -0700 (PDT) X-Google-Smtp-Source: APiQypJH0JlC0DYtDbRD+T7i/0eeFJzchPaISGCbiqBxD9NWFpxpPkR9mkRAIZ9D1wgN73MJzN8l X-Received: by 2002:a05:6808:a08:: with SMTP id n8mr12671676oij.91.1586173570932; Mon, 06 Apr 2020 04:46:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586173570; cv=none; d=google.com; s=arc-20160816; b=Z4DwtjATnrPjxqskE9ZZkIkPhB9uojUdTFFVBiLKQLDVcpPuzK2pIE1CZuxP4IalgP PPB9KeNdCKTrgWm7t+e/uCrkr+BgAynLlsW+8NqXgpcsgJ3m/g4YOumPCozuDPSagCYK Q9i7oQOS0L+jLS6ZYXeE98ogHA2scDIdflqlEoc7jZFLYPgBBFYqgCuB40Od9zlYnwjP 9vNEB8En+6Sx/vJtXCL+b7oHXkjxMvAuAFwyUzsiNMDVL+DxviBDnDy6XSt6GhdT+4xt vN/RcURyC6sUN8Bf+J0bYrF73F3aHAY8cPBWSBeVY4xeIgSuqd7Kgg1uzWg+gM/F1At0 SPfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature; bh=+xk7CgP6jiYAclcZ7ZI86n32dohhOX6V7T6Ac0tw6Ns=; b=uQqyECNoetvDF/WQAK39eczZ6dJDTD81ETUJYNDr4LjnfTFBSRN7aMsZaxp2JZxqGj Oz1qCBOuZKzZBUrCs0ZBbXRcdXErTjKlSQoxNUFfa+WcAuuxl0rsFN87QtZ4PpMkCvr9 Ra5/0blcjk8CdPWwWwkAJlHsR7bWwffdY4psGup8VOwZs+L/CBwtN9tuiYSSFBRH21lM bJSHjkKq2guhnkyQRfFOX6baIxj2mpXFGc0NdeZ/2daa5zIOU6y6KsSB5vth4xYDlqrO glJ8xXhglKoh12+h/plJq5q1rQSkygWqi6foidxwuObGC7yn9OMukynPQPPEhSd/nPsp LWzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=ZRuSBvLG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o8si7776688oig.189.2020.04.06.04.45.58; Mon, 06 Apr 2020 04:46:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=ZRuSBvLG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727620AbgDFLpH (ORCPT + 99 others); Mon, 6 Apr 2020 07:45:07 -0400 Received: from mail27.static.mailgun.info ([104.130.122.27]:38613 "EHLO mail27.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727447AbgDFLpH (ORCPT ); Mon, 6 Apr 2020 07:45:07 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1586173506; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: Cc: To: Subject: Sender; bh=+xk7CgP6jiYAclcZ7ZI86n32dohhOX6V7T6Ac0tw6Ns=; b=ZRuSBvLGlwrohh+vUV+ZYyJaJ4gSeKd8nRY8nDjDq8hbNFqdKEWacxtrt0Mwxrpj9sF2D7PT zf9a0/69osGoXPmZrp12Eq5KxtzBKgV6gPw3gF8kXzU4jvw6O+PS0GqfNlJ9npCHyMuk7fs1 dLGZtHVcNud/KzTX01e8/AH4A/8= X-Mailgun-Sending-Ip: 104.130.122.27 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5e8b163b.7f7f4da0b228-smtp-out-n01; Mon, 06 Apr 2020 11:44:59 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 7009BC433BA; Mon, 6 Apr 2020 11:44:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.0 Received: from [192.168.1.100] (unknown [157.44.182.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jprakash) by smtp.codeaurora.org (Postfix) with ESMTPSA id 9E02AC433D2; Mon, 6 Apr 2020 11:44:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 9E02AC433D2 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=jprakash@codeaurora.org Subject: Re: [PATCH 1/3] iio: adc: Convert the QCOM SPMI ADC bindings to .yaml format To: Amit Kucheria Cc: Andy Gross , Bjorn Andersson , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , LKML , Matthias Kaehlcke , Linus Walleij , Stephen Boyd , Jonathan.Cameron@huawei.com, smohanad@codeaurora.org, kgunda@codeaurora.org, aghayal@codeaurora.org, Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Rob Herring , Mark Rutland , Andy Gross , linux-iio@vger.kernel.org, linux-arm-msm , linux-arm-msm-owner@vger.kernel.org References: <1585064650-16235-1-git-send-email-jprakash@codeaurora.org> <1585064650-16235-2-git-send-email-jprakash@codeaurora.org> From: Jishnu Prakash Message-ID: <69b882b0-56ad-1b93-0a9d-2c7f96dd9d32@codeaurora.org> Date: Mon, 6 Apr 2020 17:14:47 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Amit, On 4/3/2020 5:34 PM, Amit Kucheria wrote: > >> +required: >> + - compatible >> + - reg >> + - '#address-cells' >> + - '#size-cells' >> + - '#io-channel-cells' >> + >> +patternProperties: >> + "^[a-z0-9-_@]$": >> + type: object >> + description: | >> + Represents the external channels which are connected to the ADC. >> + For compatible property "qcom,spmi-vadc" following channels, also known as >> + reference point channels, are used for result calibration and their channel >> + configuration nodes should be defined: >> + VADC_REF_625MV and/or VADC_SPARE1(based on PMIC version) VADC_REF_1250MV, >> + VADC_GND_REF and VADC_VDD_VADC. > Instead of this note for "qcom,spmi-vadc", you can enforce this > through checks in YAML grammar. > > A simple example can be found in > Documentation/devicetree/bindings/thermal/qcom-tsens.yaml. Look for > the if, then, else clause which determines how many interrupts need to > be defined. I have gone through tsens and other examples, but I'm not able to get a way to apply this kind of constraint, on what child nodes should be present. In this case, the constraint would have to be that for compatible property "qcom,spmi-vadc", there should be at least four child nodes and those four should have their "reg" property fixed to the channel values mentioned above. I can see how to apply constraints on a single property like interrupts in tsens, but I'm not sure if there is a way to specify a lower limit to the number of child nodes or something like "there should be at least one child node with value 0x9 for its "reg" property". I could not find any examples with constraints placed onĀ  number of occurrences of a child node. Can you please share an example of such a constraint if you are aware of any or suggest some way by which this kind of constraint can be specified? > >> + >> + properties: >> + reg: >> + description: | >> + ADC channel number. >> + See include/dt-bindings/iio/qcom,spmi-vadc.h >> + >> + label: >> + description: | >> + ADC input of the platform as seen in the schematics. >> + For thermistor inputs connected to generic AMUX or GPIO inputs >> + these can vary across platform for the same pins. Hence select >> + the platform schematics name for this channel. It is required >> + for "qcom,spmi-adc5" and "qcom,spmi-adc-rev2". >> + allOf: >> + - $ref: /schemas/types.yaml#/definitions/string > You shouldn't need allOf here. > > Just a "$ref: /schemas/types.yaml#/definitions/string" should be fine. > And move it above the description. > > Same for all the uses of allOf below. I'll make the change in the next post. > > >> + qcom,decimation: >> + description: | >> + This parameter is used to decrease ADC sampling rate. >> + Quicker measurements can be made by reducing decimation ratio. >> + - For compatible property "qcom,spmi-vadc", valid values are >> + 512, 1024, 2048, 4096. If property is not found, default value >> + of 512 will be used. >> + - For compatible property "qcom,spmi-adc5", valid values are 250, 420 >> + and 840. If property is not found, default value of 840 is used. >> + - For compatible property "qcom,spmi-adc-rev2", valid values are 256, >> + 512 and 1024. If property is not present, default value is 1024. >> + allOf: >> + - $ref: /schemas/types.yaml#/definitions/uint32 >> + > As pointed out by Jonathon, please enforce these by keying off the > compatible property. I'll do this for all properties for which it's applicable in the next post. > >> + qcom,pre-scaling: >> + description: | >> + Used for scaling the channel input signal before the signal is >> + fed to VADC. The configuration for this node is to know the >> + pre-determined ratio and use it for post scaling. Select one from >> + the following options. > Please improve this description from the old binding. Does <1 3> mean > the signal is scaled 3x or 1/3x? <1 3> means it is scaled down to 1/3rd of actual value. I'll add to the description in the next post. > >> + <1 1>, <1 3>, <1 4>, <1 6>, <1 20>, <1 8>, <10 81>, <1 10> >> + If property is not found default value depending on chip will be used. >> + allOf: >> + - $ref: /schemas/types.yaml#/definitions/uint32 >> +