Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp12172935rwd; Fri, 23 Jun 2023 02:20:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ477qmt5+CfVXuJSRRhle3jlg1lL7ohlpHyWChQedh5Ykd9YIIft3bwx9CMj4TR3FeiRsfu X-Received: by 2002:a17:903:278e:b0:1b0:339d:db6a with SMTP id jw14-20020a170903278e00b001b0339ddb6amr8553030plb.21.1687512016651; Fri, 23 Jun 2023 02:20:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687512016; cv=none; d=google.com; s=arc-20160816; b=b5FwQZ/wGEQscqQtbD9QB9fd8FrBzzMiM85/GVgfSgr3kBYJrac/pcKZAUkT4CiPLm GMCWcWWjxXTwyz7mprpScw5Vxj9DnhIwKuZKxx45h+OJFn16svWLsn+NaO+1J+LhmcCk avA7CBI4UIRSVCsp4PR/fNFxxLuJZEmf4n316JthHFwNZuTf01u8ftfyn8qPKO4iKHJO cqThih28xiBsM0G3HEGnVMaBcemlGohREmzNFRyvWVdXkk61/haonphk72EXAWD5kl6k lL+sIrLB8xvF17Z/XBR+0IhI/2F0P1qU2Hje1DBDJOKgtHG2vDT0rVBOlGf6TKQsO19T 40HQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=rgrvFu84ZrZIMRnZAFcmpkUkbG8qISQlNfLp/T/UU5I=; b=Zh868LkaIEz+l6FkwQj/WLIFrEq6w58GndbR9/M71moQgTsBxpxTxd82vnEbOU46Yk 4/NEIpGtnirtJiBvUhdrO/3DYRpg6490i+ynb/4Cc9XhEGKZ16vEqpH4tiocsB9mMD0n i7ZPbUhQs9Cs8iW/CU3OCg0hpn8cXgsE0nKomU3afk7AK1DB9FSNRd2NX3OFMacFZ2RW dJj+uhQhr9zKjaxhDIFNCbt59sRYCy8udwKqmuHpNVOXmOoeu2iQjvHg8StFQ4fEEZyo WA5dLQSayhds+San6iMgibZds6nET11hrTBT3BP7DU9iPSBNB/Mj9nwHzwPIaAs3yFCe jeHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=CLzL0Eh0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kv5-20020a17090328c500b001b3d7f53224si4832328plb.463.2023.06.23.02.20.05; Fri, 23 Jun 2023 02:20:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=CLzL0Eh0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231960AbjFWI67 (ORCPT + 99 others); Fri, 23 Jun 2023 04:58:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230260AbjFWI6v (ORCPT ); Fri, 23 Jun 2023 04:58:51 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::224]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E25A2139; Fri, 23 Jun 2023 01:58:49 -0700 (PDT) X-GND-Sasl: herve.codina@bootlin.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1687510728; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rgrvFu84ZrZIMRnZAFcmpkUkbG8qISQlNfLp/T/UU5I=; b=CLzL0Eh08jrIftwnY5tvc3hLa+aqBLyyvgkWdSq2R+LHaFIfZ85y3mX8jo0cf5XVdbMEFh DgypWB/vJqWm7P+iXc5osF08rfQbYzZTIA7GsKgTDLEiCyKzHcnta9VBM9XflTHldBT3A2 mUm/7W2jpD1EYI1NpcDXcm85JLC/dY17N7zf1jjBsraTYjOI5bG+w0dAKNiIzlg/ZLcy2w PSvQf8MrjiCUwP7ojwlMT5/ScfzSqbC21LnEk503/aQ5XHgCJ++exjNUNd4cwhD5tLR6v0 q26ZvYHhagGUrCkIez/p7Do36tbr+uGCZG3fIF30RNeHAL3EKvrqOHJlmpGCwA== X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com X-GND-Sasl: herve.codina@bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPA id 6D955E0007; Fri, 23 Jun 2023 08:58:45 +0000 (UTC) From: Herve Codina To: Herve Codina , Liam Girdwood , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Cameron , Lars-Peter Clausen , Jaroslav Kysela , Takashi Iwai , Kuninori Morimoto , Andy Shevchenko Cc: alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, Wojciech Ziemba , Christophe Leroy , Thomas Petazzoni , Jonathan Cameron Subject: [PATCH v6 04/13] iio: consumer.h: Fix raw values documentation notes Date: Fri, 23 Jun 2023 10:58:21 +0200 Message-Id: <20230623085830.749991-5-herve.codina@bootlin.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230623085830.749991-1-herve.codina@bootlin.com> References: <20230623085830.749991-1-herve.codina@bootlin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The raw values notes mention 'ADC counts' and are not fully accurate. Reword the notes in order to remove the 'ADC counts' and describe the conversion needed between a raw value and a value in the standard units. Signed-off-by: Herve Codina Acked-by: Jonathan Cameron Reviewed-by: Andy Shevchenko --- include/linux/iio/consumer.h | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/include/linux/iio/consumer.h b/include/linux/iio/consumer.h index 6802596b017c..f536820b9cf2 100644 --- a/include/linux/iio/consumer.h +++ b/include/linux/iio/consumer.h @@ -201,8 +201,9 @@ struct iio_dev * @chan: The channel being queried. * @val: Value read back. * - * Note raw reads from iio channels are in adc counts and hence - * scale will need to be applied if standard units required. + * Note, if standard units are required, raw reads from iio channels + * need the offset (default 0) and scale (default 1) to be applied + * as (raw + offset) * scale. */ int iio_read_channel_raw(struct iio_channel *chan, int *val); @@ -212,8 +213,9 @@ int iio_read_channel_raw(struct iio_channel *chan, * @chan: The channel being queried. * @val: Value read back. * - * Note raw reads from iio channels are in adc counts and hence - * scale will need to be applied if standard units required. + * Note, if standard units are required, raw reads from iio channels + * need the offset (default 0) and scale (default 1) to be applied + * as (raw + offset) * scale. * * In opposit to the normal iio_read_channel_raw this function * returns the average of multiple reads. @@ -281,8 +283,9 @@ int iio_read_channel_attribute(struct iio_channel *chan, int *val, * @chan: The channel being queried. * @val: Value being written. * - * Note raw writes to iio channels are in dac counts and hence - * scale will need to be applied if standard units required. + * Note that for raw writes to iio channels, if the value provided is + * in standard units, the affect of the scale and offset must be removed + * as (value / scale) - offset. */ int iio_write_channel_raw(struct iio_channel *chan, int val); @@ -292,8 +295,9 @@ int iio_write_channel_raw(struct iio_channel *chan, int val); * @chan: The channel being queried. * @val: Value read back. * - * Note raw reads from iio channels are in adc counts and hence - * scale will need to be applied if standard units are required. + * Note, if standard units are required, raw reads from iio channels + * need the offset (default 0) and scale (default 1) to be applied + * as (raw + offset) * scale. */ int iio_read_max_channel_raw(struct iio_channel *chan, int *val); @@ -308,8 +312,9 @@ int iio_read_max_channel_raw(struct iio_channel *chan, int *val); * For ranges, three vals are always returned; min, step and max. * For lists, all the possible values are enumerated. * - * Note raw available values from iio channels are in adc counts and - * hence scale will need to be applied if standard units are required. + * Note, if standard units are required, raw available values from iio + * channels need the offset (default 0) and scale (default 1) to be applied + * as (raw + offset) * scale. */ int iio_read_avail_channel_raw(struct iio_channel *chan, const int **vals, int *length); -- 2.40.1