Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp2367811pxb; Fri, 8 Oct 2021 06:27:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxuL0gqM2JkllSaB8XcuepqypfbDiJWudlJRAtWD+LJRgMu7WrWa0kgl/ZVIFDU/MTGg5RD X-Received: by 2002:aa7:88d6:0:b0:44c:5c0b:c8a8 with SMTP id k22-20020aa788d6000000b0044c5c0bc8a8mr10409344pff.76.1633699661296; Fri, 08 Oct 2021 06:27:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633699661; cv=none; d=google.com; s=arc-20160816; b=dfhyvcNbXxYhKrqK+RNSWsoTRGbj06itkffD3lMWHzuJkrK+Y2IX2r/P5XlksvvVUJ K6Hw8YoIZgknsu0oua53848BPxSk0goGaZwg/apQKIqshHlI3CbrrMcwOoXkYI50ZsQ5 bwXYGqcqmZ/G3Ym6zpTPtjxQREeA2pIyViczlEklH3WBmNl3cCJ76e5RQHTxGFacMTcx w7R2oAs5m0bcR3EMP0ZVDuTr/q3mVsL8gIKe1P0haQ9dTD6SE1rFCaObqtrISfz7v0ca 2XeCuOWAIlwliVBIVIImsbNWLsVODZBFXD+TEOZALKULn9iprxXihbWWAYgGgDxqPQMb EKMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=9cq3pyd6+P1KyVokp1RRBpzdAal1KEUlphIpxauekP0=; b=Ab+X8uAe8ch3p5yWCq2g20ZvklHLnE0/UrN8RRcDPvua+xCauTAIEFl9WTK7LDyVyU zalE1bGHOdZkVCw47OQj22EwNcZKYxQ0tmznJhO8FBpaaLAiycBWMz++STA5ZAemSwxX rXHECchykaY1DTjHnTZ7DSgP0GpCDc1Mh+wi9TFP2O6j9wga/LBU78jjezXuvD7+hCX0 m9ELBzdaNx1nmTfQhUDck3U2jUOYCrbsj7lHEw/poLBVT0K0aJRmIaGvl0URnqNNFvgL Y3Ao1kA9yEt9gnJ2vm6Pvjipwo3NwexPbnZdeGX/yN9UoJK2wiA/GjvUAO2BAAqDic0+ 1N+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=qXUev3Va; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 10si3028239pjh.48.2021.10.08.06.27.26; Fri, 08 Oct 2021 06:27:41 -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=@gmail.com header.s=20210112 header.b=qXUev3Va; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241522AbhJHN1W (ORCPT + 99 others); Fri, 8 Oct 2021 09:27:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230282AbhJHN1V (ORCPT ); Fri, 8 Oct 2021 09:27:21 -0400 Received: from mail-oi1-x231.google.com (mail-oi1-x231.google.com [IPv6:2607:f8b0:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD03AC061570; Fri, 8 Oct 2021 06:25:26 -0700 (PDT) Received: by mail-oi1-x231.google.com with SMTP id o83so6292893oif.4; Fri, 08 Oct 2021 06:25:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=9cq3pyd6+P1KyVokp1RRBpzdAal1KEUlphIpxauekP0=; b=qXUev3VazEI9TlAGHVK0h0WsqbUqu7Cj9spk7kfk7aP5jxpY6HHO/R/q/ixDYeduCa iNdhDYMwAjUCgtm8zt3nGX6fc0c1fJiCuROH41r8xGKKWP6+HIUihTuppj9prYJ5q77o KP5sdd+5AK4LY+1top4904cY7UDCE7ygp4VudHfxEKIm5cU9OFyndoUH4iOe8Gqh8BmU 0v6Af936HPUFZwJPdR7G6B2DExHZ7OTyhDRk6UbD9EScqZVxNfgczesxxzQHbe+VGjTB dXDEZjSwAFMb53TLgArilVqgLhR+EDeTq6bzVIG5MFgRbdgPjZpKeNICGnK7VKAcOBqF 4IeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=9cq3pyd6+P1KyVokp1RRBpzdAal1KEUlphIpxauekP0=; b=8Ocq/HKumMhCKxE6WsRUloZXU/4USEdkyceEUGP10a8kPYBo5V/EBhjfSqxJxnkTNs qeUE4SN73+LEojVuotV5ZIL0ClKHOEJFUoaJmQD0hFM8jb+afI8DDQqLEMr1W40Dr5Yz gNYxGJvxcQpTN1wJlZ4k7tpqE+3dr/Giz5eawU0Pw/F5wvQKa5hzTKjnnG+9VlLGJk27 EsLRbScP+bb7TdAxAPXTO2zFCLX7pfGkqVFstdTw0A3lkQMyWdhG0+jSJVheJPSKBY9B YiUCDneVtJYur2kHLPSXj7EgMVyMlDvX2nU+CezyCa8PfDC2yS4Nh43Bdw8wJeTMQrxs lq0A== X-Gm-Message-State: AOAM532PDCh9dHXjPFKF3zd0NR08kEu/7p8NEJG64RV1WaLf30SPATYD GAp9UQyC0KDfNqdt8uKpka8= X-Received: by 2002:aca:4bc4:: with SMTP id y187mr4509447oia.174.1633699526077; Fri, 08 Oct 2021 06:25:26 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id i127sm603757oia.43.2021.10.08.06.25.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Oct 2021 06:25:25 -0700 (PDT) Sender: Guenter Roeck Date: Fri, 8 Oct 2021 06:25:24 -0700 From: Guenter Roeck To: Oskar Senft Cc: Rob Herring , Jean Delvare , Linux HWMON List , "linux-kernel@vger.kernel.org" , devicetree@vger.kernel.org Subject: Re: [PATCH v2 1/2] dt-bindings: hwmon: Add nct7802 bindings Message-ID: <20211008132524.GA4171482@roeck-us.net> References: <20210921004627.2786132-1-osk@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 08, 2021 at 09:07:47AM -0400, Oskar Senft wrote: > Hi Rob > > > > > > + temperature-sensors { > > > > > + ltd { > > > > > + status = "disabled"; > > > > > > > > Don't show status in examples. > > > Hmm, ok. I found it useful to make clear that a sensor can be > > > disabled, but maybe that's just always the case? > > > > Yeah, this case is a bit special. The node not being present also disables it. > Oh, I didn't realize that a missing node defaults to "disabled". What > I want to achieve is that if a node is not present, we don't configure > it. The reason behind this is that the HW provides a mechanism to > configure itself at power-up from a connected EEPROM. In that case > we'd still want the list the nct7802 in the DTS, but without > configuration. This effectively is the current behavior. > > From what I understand from [1] and follow-ups, having the extra > "temperature-sensors" level is actually not what we want here and I > proposed a different solution in [2]. > Turns out this chip has another level of complexity, where a channel can either be a temperature sensor or a voltage sensor. So, from dt perspective, we don't have separate scoped for the different sensor types. I don't really like [2] to indicate voltage vs. temperature using "mode" (it maps both sensor more and type into a single property), but I agree that two levels doesn't really make sense here either. That is where child naming may come in. We have "sensor" in your proposal, and "input" in the tmp421 proposal. My thought on that was that we could use the child name to distinguish sensor types. temperature-sensor@1 { /* RTD1 */ reg = <0x1>; status = "okay"; mode = "thermistor"; /* Any of "thermistor", "thermal-diode" */ }; voltage-sensor@3 { /* RTD3 */ reg = <0x3>; status = "okay"; }; or maybe sensor@1 { /* RTD1 */ reg = <0x1>; status = "okay"; type = "temperature-sensor"; mode = "thermistor"; /* Any of "thermistor", "thermal-diode" */ }; sensor@3 { /* RTD3 */ reg = <0x3>; status = "okay"; type = "voltage-sensor"; }; > On that background, I'm wondering how we could have compatibility with > the previous behavior, where the individual sensors were not listed, > and just defaulted to whatever the HW came up with, whether that was > power-on defaults or loaded from an EEPROM. > > What the code currently does is to check for the presence of > "temperature-sensors" and only attempt to configure any of them if > that top level node exists. This enables backwards-compatibility. > Going forward, I would have done the same for sensor@X and only > explicitly enable / disable the sensor if the node is present. If it's > not present, I'd use the power-on / EEPROM-provided defaults. > Makes sense to me. Guenter > Thanks > Oskar. > > [1] https://lore.kernel.org/linux-hwmon/20210924114636.GB2694238@roeck-us.net/ > [2] https://lore.kernel.org/linux-hwmon/CABoTLcQYHZbsgzXN7XXKQdDn8S-YsuE+ks9WShAEKcBJojEfcQ@mail.gmail.com/