Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp1368884lqb; Thu, 30 May 2024 08:15:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWo+TjjLLy2+37drmW2104koN1BbBeeLWvj3TWaOqnyLUJxRtudIbpYxpkXITkGivI9NyXF2zwLkiLgPq5psWOB9HZZRAxLoVxkKWifNg== X-Google-Smtp-Source: AGHT+IGRz8dBiEShPH3VQ18XfooFFQZOLZvhzOJrlALANmvd4hh8fGegZL7NCYvF8CFzkfffTj9a X-Received: by 2002:a05:6102:3550:b0:48a:607d:ec20 with SMTP id ada2fe7eead31-48bae819952mr2641683137.0.1717082124946; Thu, 30 May 2024 08:15:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717082124; cv=pass; d=google.com; s=arc-20160816; b=ONgmAuKEE5u8u/b6SVSc4r4d4qRz2NOuMQBVyV/k7haFLzUYz3RBZanDJAGB00dWUT QwLzKGT6zaOheV6FOFW3AUDwUwAnn1X7aCsPvto+ckHQ0AavYTIM3q6mKOfy/T+3icPu c6c2qzs30k+3jlLqZlkEpsDJKad8hpNP5AKN0ZFQt+0+T2kDthEnWBXD3xxzZmK4rXu5 924vb1lEC6YHmSR2QyB7TIYqHCxaNdho8VRyPYn8+bWUsIqEzxVfqZWQij+6NFJtcq5h nkkjcMu9BPmFwVQeD/SUnWKkrJwXxRiquLRbodSKUuicK3Fd0/hfoAji71SjECz5RNmg M3/w== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=t4w88jG14W8tbyoxnuDjksObbCEh378HI0SyckpcTik=; fh=cQhTmLTKswK7rpQv5Acz5eBrJ7+oScS2tkCBs5P+PJY=; b=Fb7Vhf9ogBI9Uu0D5KXLZNVaEUYBTSre78ltmqowNvPKvLICgBZbXfwevDKVa4Xg4a zLzPuo2PBmkcM56N6W72MFfpMPT+xzonAe6fcNZM8QAPnswAZ8MDcFbLzeioYVwdIBv/ Y/GVSvTeKHdHdS3y/IQx/LEgQcfvfn4Hp3Hb4sF6vqtL44d9oX4BotnbUEzGux8VDPv4 YM/kB1dbsK8uvPaPSV2uCPARnVqMoNg4yWCCkusYd4kZFXdeVRpNa6yG0e6EdPhcic8I sh5JjdP0hax0bq9TfhytBWYx5j2nAKY11VzoujI3+u/MUJpSCYpMsBMneeJr4MFDTzSS UxMQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=gGjYHH6H; arc=pass (i=1 spf=pass spfdomain=baylibre.com dkim=pass dkdomain=baylibre-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-195585-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195585-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id ada2fe7eead31-48a3a3d15b1si3450938137.662.2024.05.30.08.15.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 08:15:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-195585-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=gGjYHH6H; arc=pass (i=1 spf=pass spfdomain=baylibre.com dkim=pass dkdomain=baylibre-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-195585-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195585-linux.lists.archive=gmail.com@vger.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 5F15C1C24AF9 for ; Thu, 30 May 2024 15:15:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6E25517FACD; Thu, 30 May 2024 15:14:33 +0000 (UTC) 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="gGjYHH6H" Received: from mail-ot1-f47.google.com (mail-ot1-f47.google.com [209.85.210.47]) (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 4865E18757D for ; Thu, 30 May 2024 15:14:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717082072; cv=none; b=uM5ztmQh61lrj8CuwVGiT6Fhr6445RAUGfAqyR3lzcHCrMnCR6tZFrx/B98v/3ddQQc5L+wGECUtGsNUOzCg0/CPVHZtp52LbgCE9ihx3PtY8McYoezDBDrE4DZxTAC5ndIoyX8vgfhx+ftPjxqFaoDbEgzYy+IHHh9Ss6aYYhI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717082072; c=relaxed/simple; bh=I/jkTMXlLafovZFF919I/1URD8ND1uDK1lvXCQbwghI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=IfSsMvfGA49OFVHhwaGag6vGS4nOVSi9YPrIh0ryDopxpCDZWeUrjd9okiUvCWTWxbHqA42tKH2jcVBzYRsarEx7fdfdvG3Ei6MjUFjp4ILqYaEouw1e9s3ydtTFPLtCKtRpAARnDdVitNRG7CfxTgnhcGl1+TwcDH3AQb/3+Pc= 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=gGjYHH6H; arc=none smtp.client-ip=209.85.210.47 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 Received: by mail-ot1-f47.google.com with SMTP id 46e09a7af769-6f12ff2da3fso550272a34.3 for ; Thu, 30 May 2024 08:14:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1717082068; x=1717686868; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=t4w88jG14W8tbyoxnuDjksObbCEh378HI0SyckpcTik=; b=gGjYHH6HbPU2D47dAacFXaoCeli+SU3PNzAk/9KkZPx1010w2m1q8UIXntxhnC9cH2 FTX+HVMwqPbElPmhuQtAvw6TjZvtE3Owd1ZdqoKiXLYZgdh0VdQdwdGMnwQP/NdLsFn/ nehs6glapOgjraOvtgyW8QkBqMoz5cx6jUmojF3LgZQV/+LU24Yp76TQF8z+LZ1ZJCK8 ua6738IEXnyxErVzN+KpxhTPT30w1LmKcBMyMCJ1cwNEindZhpqi2oRQ++E4FnEzRnVe WHk8fB6lx21iHczMbYxgMUbmZQl4ciFK25SUsIceyf4iWvo6LGFAbs1988EI+xyF/CGh bS6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717082068; x=1717686868; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=t4w88jG14W8tbyoxnuDjksObbCEh378HI0SyckpcTik=; b=Q/c7jJkRY1ipjLcoBzo2LPAeC2SGChumY9xblwjYdblpsUgI9SMPz7dLJfj5JivcU4 gx50EpblfgUsh4IA6QvPT4uHoeAVmP7Rk0DH7KNRrXmNs9Ma5uNjFkw0EsqU7JgoxgFy uK5w7pZZsA8U3eWp0jNZNoleYzqni1Bsl7ALcaA3csNEkLgYVb+6MSDe8OJueL2fPjUO RR+vyXEQfLRv2lS2HrUZt7kE0ZR6Nu41L+FNyf00YBXJfHZcuhAnteMFHMZPC5N5m6SH l+1PzD7jMlDJ8yPR8m5mOhRChUg5bRBxgVeOx9C/htb7OdPhIR74m6hOc92CtCSRk4xP c8kQ== X-Forwarded-Encrypted: i=1; AJvYcCVWYwfEzcoMnMtqSt0CYH+9y1NC4t8BTJkhzUBegPGnXTsD+c1Ddw3X3NsIOkkyO0z1Erec868JGdUREAz3k5XqdZuSM8nWg8T8ALrI X-Gm-Message-State: AOJu0Yxpepd2dqvNChGAb6gn1nCLvyEo8pOwBSyIaRj80/Qp+AKh8QTn qKL+ECAW3CORkYanu5OKEnxtA2EuJDX/wpt0ATPQCpqQqCaCAqdIbZe4YIgAlLg= X-Received: by 2002:a05:6830:1bfa:b0:6f0:3c3f:6893 with SMTP id 46e09a7af769-6f90af7c168mr2421658a34.38.1717082068271; Thu, 30 May 2024 08:14:28 -0700 (PDT) Received: from freyr.lechnology.com (ip98-183-112-25.ok.ok.cox.net. [98.183.112.25]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-6f8d0de6314sm2803425a34.41.2024.05.30.08.14.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 08:14:27 -0700 (PDT) From: David Lechner To: Jonathan Cameron Cc: David Lechner , Michael Hennerich , =?utf-8?q?Nuno_S=C3=A1?= , Julien Stephan , Esteban Blanc , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 0/5] iio: add support for multiple scan types Date: Thu, 30 May 2024 10:14:07 -0500 Message-ID: <20240530-iio-add-support-for-multiple-scan-types-v3-0-cbc4acea2cfa@baylibre.com> X-Mailer: git-send-email 2.45.1 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" X-Mailer: b4 0.12.4 Content-Transfer-Encoding: 8bit Up to now, the IIO subsystem has only supported a single scan type per channel. This scan type determines the binary format of the data in the buffer when doing buffered reads. For simple devices, there is only one scan type and all is well. But for more complex devices, there may be multiple scan types. For example, ADCs with a resolution boost feature that adds more bits to the raw sample data. Traditionally, for slow devices, we've just always used the highest resolution mode, but for high performance ADCs, this may not be always practical. Manipulating data after every read can hurt performance and in the case of hardware buffers, it may not be possible to change the format of the data in the buffer at all. There are also ADCs where enabling the higher resolution can only be done if oversampling is also enabled which may not be desireable. To allow for more flexibility, we would like to add support for multiple scan types per channel. To avoid having to touch every driver, we implemented this in a way that preserves the existing scan_type field. See the "iio: add support for multiple scan types per channel" the details. The first couple of patches are just preparation for this. [1]: https://lore.kernel.org/linux-iio/CAMknhBHOXaff__QyU-wFSNNENvs23vDX5n_ddH-Dw3s6-sQ9sg@mail.gmail.com/ --- Changes in v3: * Changed return type of get_current_scan_type callback to int. * Brought back updated ad7380 patches. * Link to v2: https://lore.kernel.org/r/20240524-iio-add-support-for-multiple-scan-types-v2-0-a6c328fdfab7@baylibre.com Changes in v2: * Use union for scan_type and scan_type_ext. * Dropped ad7380 patch - those changed will be squashed into the next revision of the series adding the driver for ad7380. * Temporary updated ad7380 patch for reference: https://github.com/dlech/linux/commit/64be3de241e73b43c5a5daa44b6b97f35f0743bf * Link to v1: https://lore.kernel.org/r/20240507-iio-add-support-for-multiple-scan-types-v1-0-95ac33ee51e9@baylibre.com --- David Lechner (4): iio: introduce struct iio_scan_type iio: buffer: use struct iio_scan_type to simplify code iio: add support for multiple scan types per channel iio: adc: ad7380: use spi_optimize_message() Julien Stephan (1): iio: adc: ad7380: add oversampling support drivers/iio/adc/ad7380.c | 335 +++++++++++++++++++++++++++++++------- drivers/iio/industrialio-buffer.c | 129 +++++++++++---- include/linux/iio/iio.h | 94 ++++++++--- 3 files changed, 450 insertions(+), 108 deletions(-) --- base-commit: b4bfc5f52090336f5f5b65bbdac394ac1001952d change-id: 20240507-iio-add-support-for-multiple-scan-types-f4dbcf4c2cb8