Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp1150499lqo; Sat, 11 May 2024 09:22:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWhc1WDDW5GqW4bakVbgiWRImiGigDETTrPfE8vfBncgMZIXsSCDUea/zbAx0juitvdMAPL2bjm4PGawLuyk4UDtQXtcTrpxkaXGhkntQ== X-Google-Smtp-Source: AGHT+IFbehDZ7g6quUzF2khXnl+WpVrLW8QEA9vPEPAYcwXax/tbEoYVJVq8q2sRKm+NKjE2eRkf X-Received: by 2002:ae9:f44d:0:b0:792:c34d:482 with SMTP id af79cd13be357-792c759abe8mr572966985a.25.1715444536507; Sat, 11 May 2024 09:22:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715444536; cv=pass; d=google.com; s=arc-20160816; b=XdGFhnALoWb/Sn9F5NEi+d4eukRJO23Y+sCAdHc/CC3VEqGk/ZIwzfibFrt6I7HLmf j57gtIHh2OYuU7ZjTW4HdcRRFWhromGbsR1KJLAeV2oSTeK7sy4jcIHQHFnm2H/cQvtS BcrGHUA9yWrrojuzuF+EDCFERHSfKk/GpISxhj+JhegfaWnVc9Vh3gj3IF1u5pRYhnl0 pGOwHuU4vc7e8eQSHbXvrS1zyuwL39UxUvzAeYN8M3qtKqw/4oeGUOrR1FSz2QYdEgOx dyG4R6KoAzDI+lQidMBz/tMPJJ9HbQb60mI8t2BuaYO5CAaKmXFThipFmaoGdbujg/nf pVMA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=iKJ25skIFYctiu4A6eMcAf+Rw5YnN0wH+IIVR6HxUOo=; fh=3aR6AE3tOsBoRmi/0fys5g5WNsPMOXz1nKhERDJIcyI=; b=Tilpi9W884h7++hDyyCmsfmaMDt6u4B15+Y1ddnb2RsPjPRBo35N7ThODAIaNwXBST opsx4pp50GUe69cm/7bCS0x74oBJI0RYa8yjiwGzWKMMoMI6gYD5388JlfKd6AF3a/79 UXVWY7tWKiPTWXhhFINHs1R5SHwtoGrQYNg4j3dLeKwiwwfpiwqYNm315Q6lypSuk4En 1Z7o/0m/qsb9Ki9TV9Y26ZrdV9jqKBv3nrFRHkvnDO3hgbAEA8u9LhfNjVKIVbnXDZzd vondiYhBcG4e+bcseqSIxofUXKK5MURTAdbPgRQiQaHj6rBeYgHxDdd0PFIIw2Cwypvp z62A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="pUia6/GJ"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-176641-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176641-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-792bf337a8asi577471585a.468.2024.05.11.09.22.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 09:22:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-176641-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="pUia6/GJ"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-176641-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176641-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 21B691C20DE8 for ; Sat, 11 May 2024 16:22:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C58DF56766; Sat, 11 May 2024 16:22:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pUia6/GJ" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E0C0E56B7F; Sat, 11 May 2024 16:22:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715444529; cv=none; b=gwhRZYwCO+aLOD94Bqiv1+SevTRoEiGh3aKUcmBA0J8LDcdQJb1Fherjf3TeN1JyJfG7ESPZT0+PTkJOb6WJ9G0hQL7HWf9tX/I02mS1f4hfUPqkUN+KcoPAW9eVs3vSWRJHzzsDpeiZwNfcAnHfAZrX9Tcucuv75y58bxcqDtc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715444529; c=relaxed/simple; bh=waGZCjYc4EYoDlFRXsZRE3LgBvKQnnMdiOCAiz2Or9o=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mejdGM30sOG99Ug6TMlkY7SxEepquNmmuVNjynWMPCdijv/E2hw1t4rW6e+HlWwU/powyEWwV/cVeJ7XuS+k6YbTjKqIiAd3ykwM7ICOZ21AE1dB95op0E0UpzPh1M9owv9yim3ftiNfJukWxddf+2ke7+x/3dI6MyN0CxKTsMY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pUia6/GJ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2E07C2BBFC; Sat, 11 May 2024 16:22:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715444528; bh=waGZCjYc4EYoDlFRXsZRE3LgBvKQnnMdiOCAiz2Or9o=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=pUia6/GJ/XPK9APwp4JYfbzEwt6LAl7RDFE9bwqBx4kaRYlMBJmpZGh0cErFE0whr wLOnsBUedJuhU2GH1arbv4VJdwvX6xIU8AgrrZ3iOjY1qyVgeFl0tmCaark/jNfnX9 RLanF+02PGK9ZE1youvcLMirMEGHCMxqVs9MnKiNsDVyzY32ORJ98s7gNM5LdQefZB 3V+RmGqPXgCzrTFB402Obtar39ONhwy7hSkuLnNHvyae9msA4p3d4NFA/gQFAYJlde XbuSCJOqYlq4Xn901LC9hT/8yPtR7s9gzYNroAPIFEOKVLsDoZuu8vZsYSZrT5eQwK DVVz57QgPFa5Q== Date: Sat, 11 May 2024 17:21:55 +0100 From: Jonathan Cameron To: David Lechner Cc: Mariel Tinaco , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Mark Brown , Michael Hennerich , Marcelo Schmitt , Dimitri Fedrau , Guenter Roeck Subject: Re: [PATCH 0/2] add AD8460 DAC driver Message-ID: <20240511172155.08bc0987@jic23-huawei> In-Reply-To: References: <20240510064053.278257-1-Mariel.Tinaco@analog.com> X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Fri, 10 May 2024 12:30:46 -0500 David Lechner wrote: > On Fri, May 10, 2024 at 1:42=E2=80=AFAM Mariel Tinaco wrote: > > > > The AD8460 is a 14-bit, high power +-40V 1A, high-speed DAC, > > with dual digital input modes, programmable supply current and > > fault monitoring and protection settings for output current, > > output voltage and junction temperature. > > > > The fault monitoring and shutdown protection features were > > supported in the earlier versions of the IIO driver but was > > scrapped due to uncertainties if the functionalities belong to > > the IIO driver. However, it would be best to implement it for > > the device's quality of life. I'd like to know if it's better > > suited as a stand-alone HWMON driver. That probably doesn't make sense. This reply btw is based on the text here. I haven't yet looked in detail at the datasheet. Some fault conditions are relatively easy to map to threshold events on an input channel. The ones that are harder are things like short circuit detectors where it's hard to know what the actual threshold is. The other place we are limited is in multiple levels for the same thing. So warning and fault levels. That stuff is handled much better by hwmon where these things are more common. The issue we have is that the event encoding is a bit tight but we could see if there is a way to add these. > > > > The following are the configurable and readable parameters > > through SPI that could be implemented on the HWMON driver: > > * An enable bit to arm/protect the device on overcurrent, > > overvoltage or overtemperature events. The device is shut down > > upon detection. We don't have a good way to handle restarting from shutdown, but perhaps we could use another action to signal that - maybe even going as far as saying that the driver should be reloaded. As for the thresholds, they sound like the map to IIO events reasonably well. =20 > > * A configurable range/threshold for voltage, current and > > temperature that raises alarm when exceeded while the device is > > armed. That maps fine to the IIO event threshold controls. > > * Flags that can be polled to raise alarm upon detection of > > overcurrent, overvoltage or overtemperature events, and apply > > additional protective measures. The specific need to poll is awkward but you could do it easily enough in driver and use the IIO event stuff to signal any events detected. > > * Programmable quiescent current (optional) Could probably figure out a suitable control for this, but I'm not entirely sure what it is :) > > * Thermal monitoring is done by measuring voltage on TMP pin > > (unlikely to be included) If you did want to, the usual trick for these is to include an optional use as a consumer of an IIO provider which would be a separate ADC.=20 > > =20 >=20 > Adding myself to the cc: here since I'm interested to see what > Jonathan (or anyone else) has to say about the fault monitoring. Jonathan