From nobody Mon Feb 9 01:17:21 2026 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (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 7D74E1917F0 for ; Wed, 27 Nov 2024 09:10:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732698657; cv=none; b=KNMOZxqLJ+qD67wA+g4a3X8i62o3M6ejpCWawajF2qpAHJDdRCVaDrhpp7vSlzeAAwhOhja+KU/eWUFQ9BaubWSuF3mAVLaujrYzfq1WcDhiSyLoihKriCzCi8pF45b5ru3TBsFzraHIQSIeomizxgRXS4G4cT1EnE9fG6CV8kk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732698657; c=relaxed/simple; bh=mGChwpwq5YT7BF+pvadT8OA4CAgJuJsktPYP5RjTzOQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GstT9kOGUhLYverFdAF6J1GewcEa7ZJ9tVqttniPHB4n7nGi464EqC2BkZh5ngvxUmkeF9FCBSAVxeQ/rigImdCNS6VGqwecenbuHdB0UzIQWpnXAKLo/WSFlNavgunkOa4BIsgQhDGvLPp/4nJU8DsHLjOC3mK+8dyW9eQuBro= 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=stI6/Kn4; arc=none smtp.client-ip=209.85.128.43 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="stI6/Kn4" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-434a10588f3so21013005e9.1 for ; Wed, 27 Nov 2024 01:10:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1732698653; x=1733303453; 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=8PZCJ1UvScuEOpB5rRFdFq+kujaPZNgC8slKMTXTueo=; b=stI6/Kn40BeZXOOa3tqx3KZ88msdTna1OZwU/G5cSOEVZ3WXfGEB4vD98zfIkEVwe+ Tpyi+ANCeBUxGkpdnk6AicsbvBy+RfkjikQaX8mbF82eV/lH5rHLx54j3QpPTzr65UGV q2yLQnCbkpW8zPA9b3mFxWf57NM23Os5VpYv+ZG4RD4rXf8NAtLZwBl5oTSkhhwpkz// CTi6OPVsps97wonHI4VQIGNa695BxkPNDrrPIVOKcHVlgsSaTb4GcrH2LS9b5vLkE8+W 9UtqIhgXciEAMUmVDnNggzX3fyAyeJ+ubqXOWvsapnuQIvDlPtUyR4DkE0nHiq6yO3HD IEFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732698653; x=1733303453; 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=8PZCJ1UvScuEOpB5rRFdFq+kujaPZNgC8slKMTXTueo=; b=LoSX8dW6V4fr6Mn6QM2c1LgdFT30XKXCRpIgsvlxGAMadax220QO47YU3oFj9gNf2K 3WAdFeeH/OvowA/HETc983UyTy/LIBMKpTSDQxSFAiiy1/Qd2G1fUOItOGMffllFQVUk pdAE0CVxNFIRX1bT/tz4masDYRY+RDFeNFLO1NEwzJ8/JSsgG7cgnBcQs/oyD4AWe2+I 0i33xfyhhmRD+218ikvc8n591J4+M1FXVE7sVvcQBQLlDtJqp80Ach675jwy8kcOX+dS sk3dxLsGHVimAlGN0/5v5/jIv7GY/ue/km7lg7p/FTvT1LqlqCjp6mFBLIpqj3I9ZeSF YEMQ== X-Forwarded-Encrypted: i=1; AJvYcCWaqwK0ZVx5XwYtyFdBUl3pOzFlpVdMY8deMIo81Q3n6mK7KO7OKoXs7Z8MWaJ0I+OJMV0LjGg2+LF/4D4=@vger.kernel.org X-Gm-Message-State: AOJu0Yy+szjS2JNVxvd9LrtqdyGFMF+4YhsfjFb8qNt1Ht84vH3RDwmC tNrIF9NedmYn3izPmvXlApB/rYbfakEQo7rhEGKNLDaZyscujsNY57K5LjG1C44= X-Gm-Gg: ASbGncvlmhuSEglfHnv8hvYW8GbNz3L8NVz+omLOCZDMRskCtCYvVFYXorKqBFMZE9J LSIjnTtOgwk52QIAHks6BSvEdU4WRXnS0ePbSs1J0baKKH679Xe0WNJxE4YTI++XR5JOVhRCPMl 9XRsgMPxK8JfZVo8nDcGcns6F4qadGHnLiZunPZlynyPb0Y6349yG5gBFk+r2KOWhGs1rOvzYDj YaQYp3EQbuvzpxIRjuhtDCBvvfFBk6Qw4atM4DpGYivLxXu5odi6xKqJParaIfyxtDGqfEXRPlz DqHfWmv2RWFTElbMVwlm X-Google-Smtp-Source: AGHT+IHASFmt/+tSp+MB23odNNjU/BnjXn6PxrJ0jWKW916Rej4TxNyf5heOhcFoJD0mQihGOTYsmA== X-Received: by 2002:a05:600c:3b1a:b0:434:a968:89b5 with SMTP id 5b1f17b1804b1-434a9dc35f7mr19819365e9.9.1732698652838; Wed, 27 Nov 2024 01:10:52 -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-434aa7e5285sm14529415e9.40.2024.11.27.01.10.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Nov 2024 01:10:52 -0800 (PST) From: Guillaume Ranquet Date: Wed, 27 Nov 2024 10:06:13 +0100 Subject: [PATCH v2 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: <20241127-ad411x_calibration-v2-1-66412dac35aa@baylibre.com> References: <20241127-ad411x_calibration-v2-0-66412dac35aa@baylibre.com> In-Reply-To: <20241127-ad411x_calibration-v2-0-66412dac35aa@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 | 123 +++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 123 insertions(+) diff --git a/drivers/iio/adc/ad7173.c b/drivers/iio/adc/ad7173.c index a0fca16c3be07534547a5b914d525d05f7425340..11ff148cb5a315d32485acf04b8= d6f7d0fb6e5fa 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; }; @@ -215,6 +221,7 @@ struct ad7173_state { struct regmap *reg_gpiocon_regmap; struct gpio_regmap *gpio_regmap; #endif + u8 *syscalib_mode; }; =20 static unsigned int ad4115_sinc5_data_rates[] =3D { @@ -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->syscalib_mode[chan->channel] =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->syscalib_mode[chan->channel]; +} + +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->syscalib_mode[chan->channel]; + 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 { @@ -1213,6 +1329,7 @@ static int ad7173_fw_parse_channel_config(struct iio_= dev *indio_dev) struct iio_chan_spec *chan_arr, *chan; unsigned int ain[AD7173_NO_AINS_PER_CHANNEL], chan_index =3D 0; int ref_sel, ret, num_channels; + u8 *calib_mode; =20 num_channels =3D device_get_child_node_count(dev); =20 @@ -1240,8 +1357,14 @@ static int ad7173_fw_parse_channel_config(struct iio= _dev *indio_dev) if (!chans_st_arr) return -ENOMEM; =20 + calib_mode =3D devm_kcalloc(dev, st->num_channels, sizeof(*st->syscalib_m= ode), + GFP_KERNEL); + if (!calib_mode) + return -ENOMEM; + indio_dev->channels =3D chan_arr; st->channels =3D chans_st_arr; + st->syscalib_mode =3D calib_mode; =20 if (st->info->has_temp) { chan_arr[chan_index] =3D ad7173_temp_iio_channel_template; --=20 2.47.0 From nobody Mon Feb 9 01:17:21 2026 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.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 82959191F74 for ; Wed, 27 Nov 2024 09:10:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732698657; cv=none; b=rzfWDGTGEnS0IC9MlkacOSzkIucYTk1fnurIy2BhTzIoyUuPGSp31iKxzAXFa3Bon3bs+GY0sbnrp43lTKUFUiYE9zVjErA2Mf3ooYmtQVtpsAtBZvOZWMaQhvxTAIeomYCfcYYbv+kuaRXIcoPJIWqqRt84GNwAiueBNJaB7fs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732698657; c=relaxed/simple; bh=hi7liUjxe5RX7PGtUMrmWW50QPKb3a7b4fHNFzjuy8k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Yj0uG0kVBbyJA1JtJbpFM+GHCF1hmJ1tJs0DoVhrsJadqfNfmZYsr64KwUZf6W9fAJs6ShLIpeRaX+LSuPgBiZNh+E3XYnUuPApBhAy1WGi5SNw3SJulOliGbkQcpuofe2hIBuNBQ/3QLilTTejAb5fMQ2Ur9yd3Ji1fp+n/CTE= 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=rAeERaPi; arc=none smtp.client-ip=209.85.221.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="rAeERaPi" Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-382376fcc4fso4020487f8f.2 for ; Wed, 27 Nov 2024 01:10:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1732698654; x=1733303454; 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=D++hmFkktyJpz8KdCoh+I0yzg35pIUrfCd8imheAkBM=; b=rAeERaPiTdAiFjKfP1n3AiaNPNT/gU9HVJeuKm4CZ7HsRJ1Os1ELUD8LR9fWH3S+Iy 7J/N2JWIfzrhMzdhywuMgwKRnzpChJR1q2T3gDVA57gw3D9FeoPT27RtpvFipdeehKw+ +FxcRPsBYBUKT12Y34EkMUvb4S8PQJ5I7OLVM/3ObV2SMdpCfA4LLWAoJ8A6J5DHUiUe MGxoLf40a2HUHjRAd9gUrDShsIW+kGlJQ5S/S/z7AGP2rJF4qUCKZNs2vuF0CZ3zCAqF dEPLuckfKQztzfETdJ9+6CBbw0vn28zT+v5yYz0NWwy6FpQugsaH3/y1tm7xR8ytgiX0 qXZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732698654; x=1733303454; 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=D++hmFkktyJpz8KdCoh+I0yzg35pIUrfCd8imheAkBM=; b=j7Vm0MPDCIGMkoOLnLur3ehAEqeUc6G1hS4OLEkPb4veC48v8fr4J/QpeAR4w1SKQ4 HwQlC4mYw28OPcKKPeW0L1YvzQncGACSc6gR2IuMhoXLXdOvDKDYf0YNgKly4opa/96U sglYKC9uecrTH9ixO94vnQP8o9nKj0vtufsR5/12GGe/wtwYXufUmd0X3NvKut+0v8bF m8YQAzHccCmqzz/N2x1IHi9PI7gOews2HWhWIEyqxlwYL/FskB2FA2tSTlJI1hmtP5VO y48IIjaCbO5mtnvEvbFgHTo5vr+nRlGpMBfrNjYiuQwEFTgaZhYg8pK4gGgo6iG3c88V uvIQ== X-Forwarded-Encrypted: i=1; AJvYcCWH4HiT6VNmNSIM49e/YQ20Jjw2MU+bvuOnf2hPDTeNLh3BbcdUhDrTp5d+NowQydj+P2ijRHBHKKuHrFg=@vger.kernel.org X-Gm-Message-State: AOJu0YzeTZjkf6MTBGBXfLHEoz1/iYHiWFtz3tzo4Y3wRfo647gkELaf qBbMqU5Za22GINV2J85H01WcmbEHyUA7nPyDra55oOjNjbdOFiNZT90UvU0Tg1A= X-Gm-Gg: ASbGncvLlXbBuzaaCUHf0UW675qA5SNXEB53PvxvkbYeH9LgFIPNyUSFuZ3ou7h6qoU YExxyRC+rHQcDcFZfmaBgXKtCDcUimAwGETolVgGhkPblVcZmG8P/c6AR4/0drMnhj+FawIoOX1 ptNHE7rt0/+QU9HeYJi7MY3VIOGRGyQ9MwB85UMRtn3rC2ULo7SBHg0VwBPaywxkffwmzpWK4Ur qflzz0uZx831VEPE/itc8JsSrgC7VyBfTaE8BsXDHMAehpFWBPAx0RjpZxkZtwW0kbnMxUG4zI2 XfR2b9CZi6Qz/Ju2jNGJ X-Google-Smtp-Source: AGHT+IEFPftre0OsDTeBGSoRFHKJc3M1AJdfpQJilY19IR+WHfaPS6t600F3xsPWWTZA6Rf3QY3rhQ== X-Received: by 2002:a05:6000:1844:b0:37d:5352:c83f with SMTP id ffacd0b85a97d-385c6ebbab6mr1844313f8f.17.1732698653797; Wed, 27 Nov 2024 01:10:53 -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-434aa7e5285sm14529415e9.40.2024.11.27.01.10.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Nov 2024 01:10:53 -0800 (PST) From: Guillaume Ranquet Date: Wed, 27 Nov 2024 10:06:14 +0100 Subject: [PATCH v2 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: <20241127-ad411x_calibration-v2-2-66412dac35aa@baylibre.com> References: <20241127-ad411x_calibration-v2-0-66412dac35aa@baylibre.com> In-Reply-To: <20241127-ad411x_calibration-v2-0-66412dac35aa@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..c2c55a966163736aea8d46fc508= 9c08dac747b84 --- /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_voltagex_sys_calibration +KernelVersion: +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_voltagex_sys_calibration_mode_a= vailable +KernelVersion: +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_voltagex_sys_calibration_mode +KernelVersion: +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