Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3843066pxb; Mon, 1 Nov 2021 22:33:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVUz530IarShy+sDsE5FcO9+4PtM989KOlhsQNGlLEbWgQcHkEmDZn6/iNdPFuiDQdgaat X-Received: by 2002:a17:907:961a:: with SMTP id gb26mr41802718ejc.527.1635831220162; Mon, 01 Nov 2021 22:33:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635831220; cv=none; d=google.com; s=arc-20160816; b=AkZmYLbzllw7idFBZVpfLjnwFezJo6kULBsvfKYLtwnZTgg0wJgH3N/JoCXvtmfxts oRBvaZ4yfJnr75eglwHOPUzkZF2REUgteM2e2qLssQjCnki2aBrJPUXzNX3kp7ohYgpW 6JwktTUXtdRMFYLOy46M9ihGluPQNTI8HSSrf8Fmxkj0/lVNMbmkR27WhIvr2bRJ8u2r y6zYGZTbB/UcId9lrz634FWPNKe9lBXliUPwl1ipTn12cNh+mtyjdZ1rJNFuEptti5ys Bk0VU5amt9CfScZiZGE5W4RkcAMC4zFrVwnqvEPqC25qQWl+/p6s6B6Ik8WaCCRU3fpu 4kUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding:subject :cc:to:from:references:in-reply-to:message-id:date:dkim-signature; bh=lJnV+kITEwNEZxgW0EEwkSDW1MfbZOcjYoFW6kKKYcY=; b=l4kaCJiX4RLVMn8J8LfgrgyHMETuaOYO7qlOuTXFvNw6X4Kvsg9EpPM9OVZ7sBoVYl I2KwsEEq7WbivOfc8rYEmSWxyKZkNOnvgKMOCP1fIZWTBtxOlCBkWfpOW1xDD1f7NlGZ FT5RNzGYY0j6LkWZmy7nsdYq+mUwj0tRACczBimoy7ZnjlhNPHKN18uIrXKJrb0nz+RB /lbaTZdsb9CANOGH56sRYMykSAKFXyPmmKCuPnSHzJTMyEy/yUqHEFAfvilPVqe6sp5G MFQKtaJe5Gflz5tgUzLtAm4IuOUhXAZ9DtEvkx1vNunpIA2rTg3uhluVEUL1cGK/4cEc 9UEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nathanrossi.com header.s=google header.b=NK3AXJ9s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nathanrossi.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i9si3580600edb.355.2021.11.01.22.33.15; Mon, 01 Nov 2021 22:33:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nathanrossi.com header.s=google header.b=NK3AXJ9s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nathanrossi.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230234AbhKBFa7 (ORCPT + 99 others); Tue, 2 Nov 2021 01:30:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230326AbhKBFa5 (ORCPT ); Tue, 2 Nov 2021 01:30:57 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B2C0C061767 for ; Mon, 1 Nov 2021 22:28:23 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id t38so379830pfg.12 for ; Mon, 01 Nov 2021 22:28:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nathanrossi.com; s=google; h=date:message-id:in-reply-to:references:from:to:cc:subject :content-transfer-encoding:mime-version; bh=lJnV+kITEwNEZxgW0EEwkSDW1MfbZOcjYoFW6kKKYcY=; b=NK3AXJ9sUzOeFZfFNuCSHsmgcdy5famNh4IOfV6dhZgSoUIpg/TuKxSy7ZTYJ4U4qO IebE1+JsyfP0bYZgtagN/MelZcQVHSQKmaeq5aCRBY1V6j1uO3sHLRTvcV4e+y37uf+z hoRuOym/BqkyB7GQLiEvjT+ZO+CMxR5sMjWbItd3lQPd87dMjdq6JH5x4hucyNE+bwKx LOEBT4XRMdTOAFh/2HaB3oMNPoNiESg/DIPZrxQZEJxITE18nJkXNLK5ymxZR++nZ98f 271jN5J0N+Fyh2wmq4TwusK0JmWLh49ByveFULqBPkyescoMNno6cTTY+eQYil41O3M9 NWdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:in-reply-to:references:from:to :cc:subject:content-transfer-encoding:mime-version; bh=lJnV+kITEwNEZxgW0EEwkSDW1MfbZOcjYoFW6kKKYcY=; b=Zcs63v7v6EV04rufHDMkuYlmWic8iR1701E2yGUSXxZfIoA4x/N5YWXAstHFfnWV+D CRNe0i6rnSmLzDqkT/rtZtAp6BoWM3ls2haPPoA+UaQoXunxYKoOAsa3wqjFC4OMJ/Fi eeEs8IglNhIOLg7NBtBtcKpXSU0w44dx9479bspC4xtql4Z3o5ZlIGMdee0+2WVLXgxI OJ0zTxGmFAu82yHZD6j1/V4Gw8TBqdMTO/zDVm+qqBtE64Rx03k+p1ZC72FrdSFaJ3Ht heHEUkANi8hRrsOcJMQHrmJ1OVklcHS8eOCXbNVklbHF6JMDMA+iF9vPgoMcg5L1g35n 8/kA== X-Gm-Message-State: AOAM530ra21Ggqjqj4r0tvvrs7p3u0Zf+CbhZ/rv8TE36tf2Ma1On1Nw xOBvsCs5V1DDMmaq6v/A1tgDi6fBkOKQXh6K X-Received: by 2002:a63:fd03:: with SMTP id d3mr17864964pgh.199.1635830902444; Mon, 01 Nov 2021 22:28:22 -0700 (PDT) Received: from [127.0.1.1] (117-20-69-24.751445.bne.nbn.aussiebb.net. [117.20.69.24]) by smtp.gmail.com with UTF8SMTPSA id mp16sm1109758pjb.1.2021.11.01.22.28.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Nov 2021 22:28:22 -0700 (PDT) Date: Tue, 02 Nov 2021 05:27:54 +0000 Message-Id: <20211102052754.817220-2-nathan@nathanrossi.com> In-Reply-To: <20211102052754.817220-0-nathan@nathanrossi.com> References: <20211102052754.817220-0-nathan@nathanrossi.com> From: Nathan Rossi To: linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Nathan Rossi , Nathan Rossi , Guenter Roeck , Jean Delvare , Rob Herring Subject: [PATCH v4 2/3] dt-bindings: hwmon: ti,ina2xx: Add ti,shunt-gain property Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nathan Rossi Add a property to the binding to define the selected shunt voltage gain. This specifies the range and accuracy that applies to the shunt circuit. This property only applies to devices that have a selectable shunt voltage range via PGA or ADCRANGE register configuration. Signed-off-by: Nathan Rossi --- Changes in v2: - Added binding for shunt-gain Changes in v3: - Fix schema error, setting $ref to uint32 - Improve the description to detail exactly how to define the property and how the property affects initial device configuration and calculation of values --- .../devicetree/bindings/hwmon/ti,ina2xx.yaml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml b/Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml index 180573f26c..47af97bb4c 100644 --- a/Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml +++ b/Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml @@ -36,6 +36,27 @@ properties: Shunt resistor value in micro-Ohm. $ref: /schemas/types.yaml#/definitions/uint32 + ti,shunt-gain: + description: | + Programmable gain divisor for the shunt voltage accuracy and range. This + property only applies to devices that have configurable PGA/ADCRANGE. The + gain value is used configure the gain and to convert the shunt voltage, + current and power register values when reading measurements from the + device. + + For devices that have a configurable PGA (e.g. INA209, INA219, INA220), + the gain value maps directly with the PG bits of the config register. + + For devices that have ADCRANGE configuration (e.g. INA238) a shunt-gain + value of 1 maps to ADCRANGE=1 where no gain divisor is applied to the + shunt voltage, and a value of 4 maps to ADCRANGE=0 such that a wider + voltage range is used. + + The default value is device dependent, and is defined by the reset value + of PGA/ADCRANGE in the respective configuration registers. + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [1, 2, 4, 8] + required: - compatible - reg --- 2.33.0