From nobody Sun Feb 8 19:43:51 2026 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A63001FC10A for ; Mon, 2 Dec 2024 10:14:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733134473; cv=none; b=aHnvRP0sh5yWmHXjVsqYAK1QOeC3di+aVieADR0SkJOTM/ZVnyiwQhgHoVeyCCYyrC4a6LDzY7pxUSsp+k5B97rGWg0plnRdeZL+NEyZCTYdwr1GMW4efvyATSrHxB4KTMJ9a/+dvUKHydklxLFIqmyotQERxMK2hUuYOA3xHoo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733134473; c=relaxed/simple; bh=lxtQNPG7ecK6Iv4xprjHSTDP5kz4+CAaG6h4MbYJZwg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JXAyu93bUPXBQXuo2T62PEtqGPT9bj+kg5TKNL7+GcWPHVv92O6fvEzUQeTsnIWZLvTsk5a/CKViZnGIFO1KX6L1bgDicfchh8eHWDUUwBJ9ut+LbrhiBTNDbMnhce4HOv/gGZoAUFJ0bl3jTvZ2eLQrAt8hZ7rTt4fFzGwyA3Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=zYuWdesn; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="zYuWdesn" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-434a1fe2b43so36340165e9.2 for ; Mon, 02 Dec 2024 02:14:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1733134468; x=1733739268; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=C3sHijHsObcmuC5+B0nCO3Vf+v46fobTZzfGbKsmzqY=; b=zYuWdesn9Lcc9QTDd3FwO3o5mYT9tzQpJUMk3xEsvQFZIyQ4Go0OU1lTzeqQsj+GfJ rnoaYgJRVC9Vfe48ZtypMVps3K5T0Hvba1s9Fsnr3YjDzdql6og1HhY6iUHAR9vXyMoj zlr1PnxDaQODaUu7vHEWpjRFOdI8spP621aV+fn4NV8piqEB2ysJPAES65OrjgxM2DiP ta6cD7fhg9B+6iRh5ncz4Xa12/iz4qlJ9IvnZY+ZBTOa3/bK8B/xWrXmohwZlEJVdCgI ShvP4vhJgHkIZa1EzN9c/3LfSVooqO55Cn8Xn2dyZVCnxkuv8A2r2eaCtKiej4BxpLOh RiHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733134468; x=1733739268; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=C3sHijHsObcmuC5+B0nCO3Vf+v46fobTZzfGbKsmzqY=; b=QDkc9lqkF3Wfup81lI191zB9d3zlPwGdgcsTyVPV1t/Goftrk9sVdaFS4p3n9xlMJt alhLSk7HVGGDI5Onyy/qM2S3YM3rmFMXjwj6yLt4yvcKyJsyVQ4NkXoZUDl4PrT/jjhU 1btGKSXnOzo+on24kawtIi/2VtVP8+5kY9C3mYmdNz0zGdd0hOQaoG43paPxwn1MuR1G CxbsAPXcZfWHNMruY6tCIXvQixkUxHtUYBsGW+TLK4f+qRcHWJ1PLns2u80J/u+SvbPE mdP8oRF79sAFJJgYpT98ClqxSzFyG6STM6Lco8b4JApnjs8FPDzs2WmN+mMml+Gl0e56 tYdg== X-Forwarded-Encrypted: i=1; AJvYcCXvhDFfAnLPV69whUIe2o+xoOAsPuc6zGZoHazwFWvHQ51ttVDX1PaVFQv19viGzmljP56uccQkoTKKn/Y=@vger.kernel.org X-Gm-Message-State: AOJu0YxtHYkZC108p8r/9Ntz/8w1D1oCxOH+YnX9t9xOScq9byYbLtXg cQVJdDN4aUL5itN3DU1Vfu7cWsjsBMjGPuBJmveNJG2xdaynnVDC/Wrk99AIkNQ= X-Gm-Gg: ASbGncvyUPvW7y1N40XEY90znWXgELtOmeODyn/5y+7jGxgJ3jIx904b+ND+9PKBcCM p59Yp6Pzvo6/gCoS1b7XCzw2+6gbB/aN1lZrSl++uTbnMKRnBSm5gsspZGtbvlVUEuYHsuWkwBt 3FsA5xXM+n8heGRpkdugoEe8vE+/+rmpNitpDihu6bqcya6h/0QXeM5ALYIzr50zZDsCmdUPQ6F ifDQ2y4RTGzgpznp4StOaH4FCGF/ihpbfQ2m0rNNjmTXonNtloawUfSK5qyzKrKD0d5FtC7iB9W zgXZClipf50n0lWFLuYn X-Google-Smtp-Source: AGHT+IFjx/yJJybfJqzTJyGbOn2E5AZSxv5el1mA0qTMGPGYHc4xLYJUUBB5kp/oNkqyJxkeV2587w== X-Received: by 2002:a05:600c:4e8b:b0:431:93d8:e1a1 with SMTP id 5b1f17b1804b1-434a9df1f34mr189694025e9.27.1733134467826; Mon, 02 Dec 2024 02:14:27 -0800 (PST) Received: from [127.0.0.1] (alille-653-1-300-114.w90-1.abo.wanadoo.fr. [90.1.180.114]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434aa7e5e59sm181138325e9.44.2024.12.02.02.14.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Dec 2024 02:14:27 -0800 (PST) From: Guillaume Ranquet Date: Mon, 02 Dec 2024 11:09:52 +0100 Subject: [PATCH v3 1/2] iio: adc: ad7173: add calibration support 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 Message-Id: <20241202-ad411x_calibration-v3-1-beb6aeec39e2@baylibre.com> References: <20241202-ad411x_calibration-v3-0-beb6aeec39e2@baylibre.com> In-Reply-To: <20241202-ad411x_calibration-v3-0-beb6aeec39e2@baylibre.com> To: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Guillaume Ranquet X-Mailer: b4 0.15-dev The ad7173 family of chips has up to four calibration modes. Internal zero scale: removes ADC core offset errors. Internal full scale: removes ADC core gain errors. System zero scale: reduces offset error to the order of channel noise. System full scale: reduces gain error to the order of channel noise. All voltage channels will undergo an internal zero/full scale calibration at bootup. System zero/full scale can be done after bootup using the newly created iio interface 'sys_calibration' and 'sys_calibration_mode' Signed-off-by: Guillaume Ranquet --- drivers/iio/adc/ad7173.c | 116 +++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 116 insertions(+) diff --git a/drivers/iio/adc/ad7173.c b/drivers/iio/adc/ad7173.c index a0fca16c3be07534547a5b914d525d05f7425340..5e711b9c80840547bcfa2ad8f5f= c8e15c1acc5d2 100644 --- a/drivers/iio/adc/ad7173.c +++ b/drivers/iio/adc/ad7173.c @@ -150,6 +150,11 @@ #define AD7173_FILTER_ODR0_MASK GENMASK(5, 0) #define AD7173_MAX_CONFIGS 8 =20 +#define AD7173_MODE_CAL_INT_ZERO 0x4 /* Internal Zero-Scale Calibration */ +#define AD7173_MODE_CAL_INT_FULL 0x5 /* Internal Full-Scale Calibration */ +#define AD7173_MODE_CAL_SYS_ZERO 0x6 /* System Zero-Scale Calibration */ +#define AD7173_MODE_CAL_SYS_FULL 0x7 /* System Full-Scale Calibration */ + struct ad7173_device_info { const unsigned int *sinc5_data_rates; unsigned int num_sinc5_data_rates; @@ -175,6 +180,7 @@ struct ad7173_device_info { bool has_input_buf; bool has_int_ref; bool has_ref2; + bool has_internal_fs_calibration; bool higher_gpio_bits; u8 num_gpios; }; @@ -196,6 +202,7 @@ struct ad7173_channel { unsigned int chan_reg; unsigned int ain; struct ad7173_channel_config cfg; + u8 syscalib_mode; }; =20 struct ad7173_state { @@ -272,6 +279,7 @@ static const struct ad7173_device_info ad4111_device_in= fo =3D { .has_input_buf =3D true, .has_current_inputs =3D true, .has_int_ref =3D true, + .has_internal_fs_calibration =3D true, .clock =3D 2 * HZ_PER_MHZ, .sinc5_data_rates =3D ad7173_sinc5_data_rates, .num_sinc5_data_rates =3D ARRAY_SIZE(ad7173_sinc5_data_rates), @@ -291,6 +299,7 @@ static const struct ad7173_device_info ad4112_device_in= fo =3D { .has_input_buf =3D true, .has_current_inputs =3D true, .has_int_ref =3D true, + .has_internal_fs_calibration =3D true, .clock =3D 2 * HZ_PER_MHZ, .sinc5_data_rates =3D ad7173_sinc5_data_rates, .num_sinc5_data_rates =3D ARRAY_SIZE(ad7173_sinc5_data_rates), @@ -326,6 +335,7 @@ static const struct ad7173_device_info ad4114_device_in= fo =3D { .has_temp =3D true, .has_input_buf =3D true, .has_int_ref =3D true, + .has_internal_fs_calibration =3D true, .clock =3D 2 * HZ_PER_MHZ, .sinc5_data_rates =3D ad7173_sinc5_data_rates, .num_sinc5_data_rates =3D ARRAY_SIZE(ad7173_sinc5_data_rates), @@ -343,6 +353,7 @@ static const struct ad7173_device_info ad4115_device_in= fo =3D { .has_temp =3D true, .has_input_buf =3D true, .has_int_ref =3D true, + .has_internal_fs_calibration =3D true, .clock =3D 8 * HZ_PER_MHZ, .sinc5_data_rates =3D ad4115_sinc5_data_rates, .num_sinc5_data_rates =3D ARRAY_SIZE(ad4115_sinc5_data_rates), @@ -360,6 +371,7 @@ static const struct ad7173_device_info ad4116_device_in= fo =3D { .has_temp =3D true, .has_input_buf =3D true, .has_int_ref =3D true, + .has_internal_fs_calibration =3D true, .clock =3D 4 * HZ_PER_MHZ, .sinc5_data_rates =3D ad4116_sinc5_data_rates, .num_sinc5_data_rates =3D ARRAY_SIZE(ad4116_sinc5_data_rates), @@ -505,6 +517,105 @@ static const struct regmap_config ad7173_regmap_confi= g =3D { .read_flag_mask =3D BIT(6), }; =20 +enum { + AD7173_SYSCALIB_ZERO_SCALE, + AD7173_SYSCALIB_FULL_SCALE, +}; + +static const char * const ad7173_syscalib_modes[] =3D { + [AD7173_SYSCALIB_ZERO_SCALE] =3D "zero_scale", + [AD7173_SYSCALIB_FULL_SCALE] =3D "full_scale", +}; + +static int ad7173_set_syscalib_mode(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan, + unsigned int mode) +{ + struct ad7173_state *st =3D iio_priv(indio_dev); + + st->channels[chan->channel].syscalib_mode =3D mode; + + return 0; +} + +static int ad7173_get_syscalib_mode(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan) +{ + struct ad7173_state *st =3D iio_priv(indio_dev); + + return st->channels[chan->channel].syscalib_mode; +} + +static ssize_t ad7173_write_syscalib(struct iio_dev *indio_dev, + uintptr_t private, + const struct iio_chan_spec *chan, + const char *buf, size_t len) +{ + struct ad7173_state *st =3D iio_priv(indio_dev); + bool sys_calib; + int ret, mode; + + ret =3D kstrtobool(buf, &sys_calib); + if (ret) + return ret; + + mode =3D st->channels[chan->channel].syscalib_mode; + if (sys_calib) { + if (mode =3D=3D AD7173_SYSCALIB_ZERO_SCALE) + ret =3D ad_sd_calibrate(&st->sd, AD7173_MODE_CAL_SYS_ZERO, + chan->address); + else + ret =3D ad_sd_calibrate(&st->sd, AD7173_MODE_CAL_SYS_FULL, + chan->address); + } + + return ret ? : len; +} + +static const struct iio_enum ad7173_syscalib_mode_enum =3D { + .items =3D ad7173_syscalib_modes, + .num_items =3D ARRAY_SIZE(ad7173_syscalib_modes), + .set =3D ad7173_set_syscalib_mode, + .get =3D ad7173_get_syscalib_mode +}; + +static const struct iio_chan_spec_ext_info ad7173_calibsys_ext_info[] =3D { + { + .name =3D "sys_calibration", + .write =3D ad7173_write_syscalib, + .shared =3D IIO_SEPARATE, + }, + IIO_ENUM("sys_calibration_mode", IIO_SEPARATE, + &ad7173_syscalib_mode_enum), + IIO_ENUM_AVAILABLE("sys_calibration_mode", IIO_SHARED_BY_TYPE, + &ad7173_syscalib_mode_enum), + { } +}; + +static int ad7173_calibrate_all(struct ad7173_state *st, struct iio_dev *i= ndio_dev) +{ + int ret; + int i; + + for (i =3D 0; i < st->num_channels; i++) { + if (indio_dev->channels[i].type !=3D IIO_VOLTAGE) + continue; + + ret =3D ad_sd_calibrate(&st->sd, AD7173_MODE_CAL_INT_ZERO, st->channels[= i].ain); + if (ret < 0) + return ret; + + if (st->info->has_internal_fs_calibration) { + ret =3D ad_sd_calibrate(&st->sd, AD7173_MODE_CAL_INT_FULL, + st->channels[i].ain); + if (ret < 0) + return ret; + } + } + + return 0; +} + static int ad7173_mask_xlate(struct gpio_regmap *gpio, unsigned int base, unsigned int offset, unsigned int *reg, unsigned int *mask) @@ -801,6 +912,10 @@ static int ad7173_setup(struct iio_dev *indio_dev) if (!st->config_cnts) return -ENOMEM; =20 + ret =3D ad7173_calibrate_all(st, indio_dev); + if (ret) + return ret; + /* All channels are enabled by default after a reset */ return ad7173_disable_all(&st->sd); } @@ -1023,6 +1138,7 @@ static const struct iio_chan_spec ad7173_channel_temp= late =3D { .storagebits =3D 32, .endianness =3D IIO_BE, }, + .ext_info =3D ad7173_calibsys_ext_info, }; =20 static const struct iio_chan_spec ad7173_temp_iio_channel_template =3D { --=20 2.47.0 From nobody Sun Feb 8 19:43:51 2026 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AA5A71FC119 for ; Mon, 2 Dec 2024 10:14:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733134472; cv=none; b=owr1wTmVPBlS3CNPuyIqYJbO7W4BbgEZsuj4R9SJzJwB41gqPh6IdUI7ggZl9fHFm+KUpyiKDxgMH020dvLRWiXWXjXDFbRiJHKOWaHPDdi34M4wOMsmqGIQlMyCoErXemAk1o/OcszPf6V8B5HAOd9PBy5gNHm5TdM3WCtqKDg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733134472; c=relaxed/simple; bh=gUUTuRBqFh6i1HpXlE6OB83LoDsqVr3hA6U4CkK7QvM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=L+qWK6IglSJF6joq9hejEiNE0o15u5GnSSKI0dhY48T9wHj3JguvDtIgIzp1wPvp9qnmQ29DyQ4u3d6OPpm/OtZ3ZWbiel6QSDzpDWe8sVjgiSpJZ7DzlI5pjp1siry7BPxA/2gArM8I/IrrLjl7q5mogIhMCaxSvj7go2mEX6U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=o2qHcMqc; arc=none smtp.client-ip=209.85.128.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="o2qHcMqc" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-434aa472617so33820115e9.3 for ; Mon, 02 Dec 2024 02:14:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1733134469; x=1733739269; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=UShwHa1ujiu/7K4Zm9WNENd64U85UqA/kqLEIbdrEk4=; b=o2qHcMqcYMvouPrItrEazojopPjPbTAevmFGOHISVHdHtCPtB1icC70Kx+hDkpXfHn o7UKuRLklBY6KukcRYWQ/1m7KVNInrsSzk1BqiRKTMmYe5sKQMoc69fH8TD7ZoIEugOx +CEA+XjT4OrUQrQDRH9M0sdMFVfjsIc8LlO3igSXCFC99O1SYMroRwF31Y+6krqfd9h+ e8/qgq7K44DETVg+2F0Ydy/R3cE29Dr02sIoaWQhWjWYThrEo21205keyLZC9UOxmxLL tX5sGcrIMrSnx6MrhEH2X2xDgC4G0MYXWzmtGcasek2RteplzJJMZM8aVs9V+dqEbE5g F+Kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733134469; x=1733739269; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UShwHa1ujiu/7K4Zm9WNENd64U85UqA/kqLEIbdrEk4=; b=movnzDxHsg7R6sXQNy14pUMk1pnc+2W+wf3wXhxl8X125yCPqrAd1vld/3Qj1a5LSi XAptO1ZTh8Bz/uVbxb7Ist3zhuRkwos6wkBzcToKlqbi5OZlKdU3tDgWQ2fG9rVVodUu MZ30wCGEtkg55yv6lQ7qaGqy215dvtE3FF8CojfLf5TSVLE66DikNSUSlCVqVcq3aW4G DqE10N1tlYa5r6iidrDOYu04/2R4qUb8MZ+WFdIth9AvE/cl7IfOc9uJNS+/UXv8Eb68 wVIpE9UGRTlGfivGUpakvShCH8m85hotaHY33A+7A2ptBD3yUJMkWzYPYr9fQCmp34ad xhXg== X-Forwarded-Encrypted: i=1; AJvYcCXJbtAg7okiz2HQyMLaOqJhQTBzvhDrx+DWq2TIYcDoUfqjHGIISG684BzpOjTGdKdTHeguSvmD2gnTNOQ=@vger.kernel.org X-Gm-Message-State: AOJu0YzvGh1BDbcPzTJVDFlpeELANU11HPM2ghCfeukcmsWU4ivx5vDR 2DuuTo3H5F7Z1v4k9QVpX7ovhELcUTWtdKmZO2zssMzdiQxCn23YbyXj7+4/O3g= X-Gm-Gg: ASbGnctRcqhzkr1gC962RniyrGNoX4tQGA6tbMyrebJlWFAxQ6wf1aQVuLwehZi2pDE 9o+qP1QHZzqDFKGe8f0sjTx0uY97GuXSOfJPeq8vh1IAvQ5pq0F+5N2k+HtReiUwfCP0OHwCm7L RAI82IWhVnDYdQZTLrsi/Kl7LUq93dg0yQZIuzplsdKJTIZj6PFjZIN42FFgpxHkLjsd3p2HW4q 8Kx4gUanMVaXEc/NkbKokgmuxkHlUEvdnmZWPvMyZXa+g+U9EGeZ4fLykhyTnVAzpsK7zPUb5qk ltYvDZ/9930jbLp4hEza X-Google-Smtp-Source: AGHT+IG99R6RmHPizsPQYmPL6FxUEvS09nH38X0UgGDDBVNTdkRxoIeaJaNsFnED1YOxtAcH9liGCg== X-Received: by 2002:a05:600c:314d:b0:434:a75b:5f6c with SMTP id 5b1f17b1804b1-434a9dbea45mr229123865e9.10.1733134468819; Mon, 02 Dec 2024 02:14:28 -0800 (PST) Received: from [127.0.0.1] (alille-653-1-300-114.w90-1.abo.wanadoo.fr. [90.1.180.114]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434aa7e5e59sm181138325e9.44.2024.12.02.02.14.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Dec 2024 02:14:28 -0800 (PST) From: Guillaume Ranquet Date: Mon, 02 Dec 2024 11:09:53 +0100 Subject: [PATCH v3 2/2] iio: adc: ad-sigma-delta: Document ABI for sigma delta adc 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 Message-Id: <20241202-ad411x_calibration-v3-2-beb6aeec39e2@baylibre.com> References: <20241202-ad411x_calibration-v3-0-beb6aeec39e2@baylibre.com> In-Reply-To: <20241202-ad411x_calibration-v3-0-beb6aeec39e2@baylibre.com> To: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Guillaume Ranquet X-Mailer: b4 0.15-dev Add common calibration nodes for sigma delta adc. Signed-off-by: Guillaume Ranquet --- .../ABI/testing/sysfs-bus-iio-adc-ad-sigma-delta | 23 ++++++++++++++++++= +++ Documentation/ABI/testing/sysfs-bus-iio-adc-ad7192 | 24 ------------------= ---- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-bus-iio-adc-ad-sigma-delta b/D= ocumentation/ABI/testing/sysfs-bus-iio-adc-ad-sigma-delta new file mode 100644 index 0000000000000000000000000000000000000000..a5a8a579f4f34d5982d4d7d4545= a0bc246505910 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-bus-iio-adc-ad-sigma-delta @@ -0,0 +1,23 @@ +What: /sys/bus/iio/devices/iio:deviceX/in_voltageY_sys_calibration +KernelVersion: 5.5 +Contact: linux-iio@vger.kernel.org +Description: + This attribute, if available, initiates the system calibration procedure= . This is done on a + single channel at a time. Write '1' to start the calibration. + +What: /sys/bus/iio/devices/iio:deviceX/in_voltageY_sys_calibration_mode_a= vailable +KernelVersion: 5.5 +Contact: linux-iio@vger.kernel.org +Description: + This attribute, if available, returns a list with the possible calibrati= on modes. + There are two available options: + "zero_scale" - calibrate to zero scale + "full_scale" - calibrate to full scale + +What: /sys/bus/iio/devices/iio:deviceX/in_voltageY_sys_calibration_mode +KernelVersion: 5.5 +Contact: linux-iio@vger.kernel.org +Description: + This attribute, if available, sets up the calibration mode used in the s= ystem calibration + procedure. Reading returns the current calibration mode. + Writing sets the system calibration mode. diff --git a/Documentation/ABI/testing/sysfs-bus-iio-adc-ad7192 b/Documenta= tion/ABI/testing/sysfs-bus-iio-adc-ad7192 index f8315202c8f0df2bd4b7216f5cf8d3c2780fcf3f..28be1cabf1124ac7593392e17e4= 759ddfac829e8 100644 --- a/Documentation/ABI/testing/sysfs-bus-iio-adc-ad7192 +++ b/Documentation/ABI/testing/sysfs-bus-iio-adc-ad7192 @@ -19,33 +19,9 @@ Description: the bridge can be disconnected (when it is not being used using the bridge_switch_en attribute. =20 -What: /sys/bus/iio/devices/iio:deviceX/in_voltagex_sys_calibration -KernelVersion: -Contact: linux-iio@vger.kernel.org -Description: - Initiates the system calibration procedure. This is done on a - single channel at a time. Write '1' to start the calibration. - What: /sys/bus/iio/devices/iio:deviceX/in_voltage2-voltage2_shorted_raw KernelVersion: Contact: linux-iio@vger.kernel.org Description: Measure voltage from AIN2 pin connected to AIN(+) and AIN(-) shorted. - -What: /sys/bus/iio/devices/iio:deviceX/in_voltagex_sys_calibration_mode_a= vailable -KernelVersion: -Contact: linux-iio@vger.kernel.org -Description: - Reading returns a list with the possible calibration modes. - There are two available options: - "zero_scale" - calibrate to zero scale - "full_scale" - calibrate to full scale - -What: /sys/bus/iio/devices/iio:deviceX/in_voltagex_sys_calibration_mode -KernelVersion: -Contact: linux-iio@vger.kernel.org -Description: - Sets up the calibration mode used in the system calibration - procedure. Reading returns the current calibration mode. - Writing sets the system calibration mode. --=20 2.47.0