Received: by 10.213.65.68 with SMTP id h4csp554394imn; Fri, 23 Mar 2018 10:13:41 -0700 (PDT) X-Google-Smtp-Source: AG47ELsLlr+YlIvpW65yl9skoVerZ8SvPwGi0scqIbf7WCusn7WnSKlYMq5FRMghYqpKVrriAA/Q X-Received: by 2002:a17:902:b903:: with SMTP id bf3-v6mr30997849plb.316.1521825221354; Fri, 23 Mar 2018 10:13:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521825221; cv=none; d=google.com; s=arc-20160816; b=QcdmRGhCAQb5/PbfatUUZLGKH3MbToR+HjEf1bxWldJj1os+fApyLpQ0mXgn4sTDuU 9kmpOUsCAbzH2J2vK7CgwrJ53fGQrPOtl/rPxFMGWgOk6r3pmssvsSollfQmffYxPtZ/ CUXpg28EmFbocacRdCzi4FD9Eb398ACB8duaGaZX7M//pAQUVtfLxaNmnRrmJK3HQfa1 gY3/9VZyAyCfrtu6wxcv5h90Q6JTdSjHdS8uN5chEiUdf0HMruOfSRg0I5F/Tgc0Vic2 qYj41jaK2YLzPCrI0vRwabmPUvAtOxybs6jhxrLYwr++K+AuMhE1AyY9BuOFtl75xcpz Qffw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=KKShKD+UOaDBQZY0kPkckRpGy0HytjnEbrh/V0oKgAs=; b=xRrdRBm2gyDeCgHcoTXfN9Bo55ArtVlncQnxJX740hy7Rhgpq9wvtdSWgvkI29etF+ Qe0IvxQ9NvjlUU8zxXWqHdiXt/LTuUb6yz0DnXrJtUAdNXZyPUX/npHFqVYaelyUDKS9 DEIwtdLkfn+ReBKOHTod0QB0CeBy4ASfQ8qGZ+GxSXOEIS0DtDwjmGJOUS1MLrSh5EPO NU0E5sYLePS1X5709f99uaqI1pmKNsTAUYfGQxjZZ6Vk4rHrR8yVJSD6JfRG3XQbblz2 OLNo9nGY9fkrCBDAFeDcvQbRaCQGSpPhJAf1RF0DJ5aXwLBotdgBeiYd33ybmNC4WfyN js5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gateworks-com.20150623.gappssmtp.com header.s=20150623 header.b=q48C+JNf; 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 b17si7047248pfd.155.2018.03.23.10.13.26; Fri, 23 Mar 2018 10:13:41 -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=pass header.i=@gateworks-com.20150623.gappssmtp.com header.s=20150623 header.b=q48C+JNf; 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 S1752474AbeCWRLo (ORCPT + 99 others); Fri, 23 Mar 2018 13:11:44 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:53296 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752445AbeCWRLi (ORCPT ); Fri, 23 Mar 2018 13:11:38 -0400 Received: by mail-wm0-f65.google.com with SMTP id e194so4841088wmd.3 for ; Fri, 23 Mar 2018 10:11:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gateworks-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=KKShKD+UOaDBQZY0kPkckRpGy0HytjnEbrh/V0oKgAs=; b=q48C+JNfNWmqHeYuuvafVW8mJmf0s21KFCYy2slgLSIYc48eY7ja5rd7f3YFY3cKjT fHqDZYfkS/cxWdBLVkFEUU2ymPBOgx66dbSHZfZ/YRrJ+StP736aeH3k78OCKdcWwfMA GqjMqSVrcHTCuLDIioT3l7pbxi7io5Yh1D4X+0peiSPUMJRxweCRWJIi9qLNjDhudxF6 DQkF6RfRRu/zKkjwFdYRnYBwg0IdsgB862G3/lR55Qep+GOSg2A5MN+L8Q1/8bCQf0FP OfD3i2C0yL5YAXa8k4+z+Mu6LLMoVtwaBRNOB0akrROOE5ZreT4JsRvQ6Do36iEExvR9 5tSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=KKShKD+UOaDBQZY0kPkckRpGy0HytjnEbrh/V0oKgAs=; b=jdTWcWHt5bGUUt1KUdfXgcJPAjjTkAtdgF0d4SQbP6BQu4UTVq0dvZnw+vuAzAj41T Dy4Z/gaDQPYlv3dHjPN5mtJzjGEY+e6MPc6dtOCb4oQzhyXnaSD0bFc5erMlvzU8MMUj rAHzuYVqCLuAGYHRqfxhzQX2feUvPXjD92ZvMt/imB+DkxgTmUB0v8yCvfbQwkAWfRcG SiMgsBxa4JAmdczvkMhSwZ2Xk31xOsrBs0J/JXsiTHLcamxyAO+tnBTqq5A78un1yyvQ LKSuTXg6oTMcfE+I2l8pD+wXMy9oWHJk/ZJsFb9JbTL9MW0MAR57eUMcG8fJz/VmNLOk 23tQ== X-Gm-Message-State: AElRT7HDQ89u/ebHMPX/+fvopQVV62GTL/GaA6FAOxeyKglYu6jjQmfM JU6j30/lsyBxCRjGcfuzjPJieiaZoSsNkJ/113Qo7g== X-Received: by 10.28.224.67 with SMTP id x64mr3807205wmg.91.1521825096973; Fri, 23 Mar 2018 10:11:36 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.6.66 with HTTP; Fri, 23 Mar 2018 10:11:35 -0700 (PDT) In-Reply-To: <20180309231433.tmlfy6vwbkvopmwd@rob-hp-laptop> References: <1520287361-12569-1-git-send-email-tharvey@gateworks.com> <1520287361-12569-2-git-send-email-tharvey@gateworks.com> <20180309231433.tmlfy6vwbkvopmwd@rob-hp-laptop> From: Tim Harvey Date: Fri, 23 Mar 2018 10:11:35 -0700 Message-ID: Subject: Re: [PATCH v2 1/4] dt-bindings: mfd: Add Gateworks System Controller bindings To: Rob Herring Cc: Lee Jones , Mark Rutland , Mark Brown , Dmitry Torokhov , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-hwmon@vger.kernel.org, linux-input@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 9, 2018 at 3:14 PM, Rob Herring wrote: > On Mon, Mar 05, 2018 at 02:02:38PM -0800, Tim Harvey wrote: >> This patch adds documentation of device-tree bindings for the >> Gateworks System Controller (GSC). >> >> Signed-off-by: Tim Harvey >> --- >> Documentation/devicetree/bindings/mfd/gsc.txt | 159 ++++++++++++++++++++++++++ >> 1 file changed, 159 insertions(+) >> create mode 100644 Documentation/devicetree/bindings/mfd/gsc.txt >> >> + >> +* hwmon: >> +The GSC provides a set of Analog to Digitcal Converter (ADC) pins used for >> +temperature and/or voltage monitoring. >> + >> +Required properties: >> +- compatible: must be "gw,gsc-hwmon" >> + >> + >> + gsc_hwmon { > > hwmon { > >> + compatible = "gw,gsc-hwmon"; >> + #address-cells = <1>; >> + #size-cells = <0>; >> + >> + hwmon@0 { /* A0: Board Temperature */ >> + type = <0>; > > Not documented. > >> + reg = <0x00>; >> + label = "temp"; >> + }; >> + >> + hwmon@1 { /* A1: Input Voltage */ >> + type = <1>; >> + reg = <0x02>; >> + label = "Vin"; >> + }; >> + >> + >> + hwmon@15 { /* fan0 */ >> + type = <2>; >> + reg = <0x2c>; >> + label = "fan_50p"; >> + }; >> + >> + }; >> + }; Hi Rob, Thanks for the review. I will roll in your changes. I'm looking for suggestions on how to better define the child nodes of the hwmon sub-device: I have 4 types of hwmon child nodes supported by this device: 1. temperature in C/10 (is that called deci-celcuis?): this is a 2byte value 2. input voltage in mV: this is a 3 byte value pre-scaled by the GSC firmware from a 10bit ADC where the ref/bit-resolution/resistor-divider info is baked into the per-board firmware 3. fan setpoint in C/10 4. input voltage in mV: raw 2-byte value of a 12bit ADC that needs to be scaled based on a voltage-devider (pre-scaler), a ref voltage, and resolution (or bit width) The example I posted above shows use of the first three types but not the more complicated fourth which requires the driver know more details in order to present a cooked milivolt value. Note that the two input types above would not both be present in any single board dts as they represent a change in the way ADC's are reported in the overall GSC version. A GSC typically has up to 16 different input ADC's and the voltage rails monitored vary per board. You mention that I don't document 'type' and your correct. I'm thinking this is best done with a string using compatible within the child node. Something like: Required properties: ... - hwmon: This is the list of child nodes that specify the hwmon nodes. ... hwmon required properties: - hwmon-compatible: Must be "fan-setpoint", "temperature", "input-raw", "input-cooked" - reg: register offset of the node - label: name of the input node hwmon optional properties: - gw,voltage-divider: an array of two integers containing the resistor values R1 and R2 of the voltage divider in ohms - gw,reference-voltage: the internal reference voltage of the ADC input in milivolts - gw,resolution: the resolution of the ADC input (ie 4096 for 12bit resolution) ... Example: ... hwmon { compatible = "gw,gsc-hwmon"; #address-cells = <1>; #size-cells = <0>; hwmon@0 { compatible = "temperature"; reg <0x00>; label = "temp"; }; hwmon@2 { compatible = "fan-setpoint"; reg <0x02>; label = "fan_setpoint0"; }; /* this one represents the 3-byte ADC value that has been 'pre-scaled' by the GSC from a raw 10bit ADC (older GSC version/firmware) */ hwmon@4 { compatible = "input-cooked"; reg <0x02>; label = "voltage1"; }; /* this one represents the 2-byte 12-bit ADC value that is 'raw' from the GSC and needs to be scaled by driver (newer GSC version/firmware) */ hwmon@4 { compatible = "input-raw"; reg <0x04>; label = "voltage2"; gw,voltage-divider = <10000 10000>; /* R1=10k R2=10k div-by-2 pre-scaler */ gw,referance-voltage = <2500>; /* 2.5V reference */ gw,resolution = <4096>; /* 12bit resolution */ }; }; If I add a byte-size (2|3) or bit-width (16|24) I could essentially combine the two input types. Suggestions? Regards, Tim