From patchwork Fri Dec 15 10:32:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lechner X-Patchwork-Id: 18112 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp9174435dys; Fri, 15 Dec 2023 02:33:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IF4T+U5sBJW8k60c3rv1NwVDLy4qaYMqpCyIjLhPEesglaO/2aWWxY77TzUTTZt5N/LZTPd X-Received: by 2002:a50:8e1d:0:b0:552:b508:5241 with SMTP id 29-20020a508e1d000000b00552b5085241mr410866edw.10.1702636390815; Fri, 15 Dec 2023 02:33:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702636390; cv=none; d=google.com; s=arc-20160816; b=B96Cicyr6oVEe98PItpHXKP+6ZNQq+yJqeLX4iGrAgFjbnkB+GIVtKeAA68q/pRI8z vzumRuRrEpwd9jNQb64EjIho+gcN/rodo7XWZuk1javzA4GB9nwAULkGMxIxC1tpFgea 4LwjUeojw/x9vaeCbc664oEPFZFIiSwSKBdWhFCf1HboMVVjuEmemZsYToEx67YuQlAV LhDbZihDMAx1/ACCqCh4q0TODzKaX2iAKBZ5pE9sNRQ6UUy6usZwo8YKfT1WPjzTbRQf QQwRXBxvpHCvIfky7ue4vMxgupynJ1wn8EH7b9gncj8agF9bnPrXmSXUE+YmNetpyGFP eZAA== ARC-Message-Signature: i=1; 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=jhaWMxJt5l6q4FIsRW2fysiTs2S/n3S9lW9qDaXU97Y=; fh=wohbsT7afrX6U5J1i26xERh+OP+FD0aFafnc+zGi7ik=; b=ANcILHK63bygQASYeXskG9KzZ64XZRjIAfUZmYU4iD1KysE4BZY8Y7SegrmG5Mzozk ITbHIkkuy2VfrTCYOWOdNT/ldM742Gh4tzHxoX1k7yi2M8R2khjI7BHWhIjUtIRtY8jt ib7RFOlfVJQB5ytJaYjBxhqcOsYaXdlXz/S/vQQsGOqLSB0BH1aYdsBB3U/Q3zZGsSC5 /hw9PHLR4zsztfJFvr3WMuqsC1i7yAypAovkHZXo2scOMt8leQAp3oEXCGUtjtqYwWfd 9GlxdnZRMyAAHp4XzhZzTGCdE1P8DiSHdBatdqbA3RQLMp7C0FpU0uxRPV0PU5Ea4n6A 9wrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=pkQhqyuf; spf=pass (google.com: domain of linux-kernel+bounces-757-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-757-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id h17-20020a05640250d100b0054b8570cad1si7702527edb.478.2023.12.15.02.33.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 02:33:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-757-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=pkQhqyuf; spf=pass (google.com: domain of linux-kernel+bounces-757-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-757-ouuuleilei=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 am.mirrors.kernel.org (Postfix) with ESMTPS id 468B11F23825 for ; Fri, 15 Dec 2023 10:33:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F088D250E4; Fri, 15 Dec 2023 10:32:18 +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="pkQhqyuf" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (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 CE5EE1C684 for ; Fri, 15 Dec 2023 10:32:11 +0000 (UTC) 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-wm1-f48.google.com with SMTP id 5b1f17b1804b1-40c580ba223so6150635e9.3 for ; Fri, 15 Dec 2023 02:32:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1702636330; x=1703241130; 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=jhaWMxJt5l6q4FIsRW2fysiTs2S/n3S9lW9qDaXU97Y=; b=pkQhqyufAR2HAIKVFRE9z9E3MTab6pp/4zEwcQtkH0jcnTuqUlkjMVU+vgLdWm9Fyb /rlyqdq9LOB12MpdSOKGiqBbXReow8Fen/X6a2Y6JkN9W+vRWROFb01pB8G1/rD1XCi/ PaR0glyxPARtkALjHG9f7EyWDVOfTA/sXoETar4Uw158Aybl7tn+53C14/mgfC2yOPcf zx0GZmvNTXVnRT2Gb+GfdIHs+ymhfuEJiy8DzPb1I/HD9eR/5ZUuuMzY08/TXwG+6OKV 5wsXwWRy2usu/pwHjc59O35IHdaIva6BnrAIA+xCPoNvIn1hlf207C5n5I1Igx8Z34x1 bVrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702636330; x=1703241130; 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=jhaWMxJt5l6q4FIsRW2fysiTs2S/n3S9lW9qDaXU97Y=; b=e/4Y9EIpzvCauqpP3/yI59rlexiBGO8pqGOWC+/a29BKWX/YbX1Us3eXPJDP3GbJ61 6Ov08FUzjArbjMJKL4f9Ef+M23ITBmF/7KN5PeuCjAeyYJbw39m/w7QB0YFdYN0Dndem jTj7TXvvLR/TdrmEEiXmQ/tCAMcdHimlQIgtiDNeEas8VXCFsBkaxy/ROlUJjbx56j5x 9Q8Q/iDLJYq3ZydkPKEsyPGopLixxUAdpM4ZWeaYrMr+22iqMk3zAUaBxyq3xvpefkVW VuUqj4/WUO1bwDyf3lknZRulqrl91pJM8nHE9R0zP7NBSYG/P4OCnbgk6LpdpoR7GGLW 283Q== X-Gm-Message-State: AOJu0Yw5hIHEGxZmHtqrPy5oqXrAVo15CTKagZ1B4pjFd7tj2bOIrK4T RkcvBNwzwiJbp/E05NotREydhg== X-Received: by 2002:a05:6000:235:b0:336:4a69:aaa1 with SMTP id l21-20020a056000023500b003364a69aaa1mr1463431wrz.93.1702636329903; Fri, 15 Dec 2023 02:32:09 -0800 (PST) Received: from localhost.localdomain (abordeaux-655-1-152-60.w90-5.abo.wanadoo.fr. [90.5.9.60]) by smtp.gmail.com with ESMTPSA id q11-20020adffecb000000b003332db7d91dsm18421015wrs.39.2023.12.15.02.32.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 02:32:09 -0800 (PST) From: David Lechner To: linux-iio@vger.kernel.org, linux-spi@vger.kernel.org, devicetree@vger.kernel.org Cc: David Lechner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Cameron , Michael Hennerich , =?utf-8?q?Nuno_S=C3=A1?= , Liam Girdwood , Mark Brown , linux-kernel@vger.kernel.org, Conor Dooley , Stefan Popa Subject: [PATCH v3 0/3] iio: adc: add new ad7380 driver Date: Fri, 15 Dec 2023 04:32:01 -0600 Message-Id: <20231215-ad7380-mainline-v3-0-7a11ebf642b9@baylibre.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.12.4 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785343655914974257 X-GMAIL-MSGID: 1785343655914974257 This series is adding a new driver for the Analog Devices Inc. AD7380, AD7381, AD7383, and AD7384 ADCs. These chips are part of a family of simultaneous sampling SAR ADCs. One quirk of these chips is that since they are simultaneous sampling, they have multiple SPI data output lines that allow transferring two data words (one for each input channel) at the same time. So a new generic devicetree binding is added to describe this sort of SPI bus configuration. To keep things simple, the initial driver implementation only supports the 2-channel differential chips listed above. There are also 4-channel differential chips and 4-channel single-ended chips in the family that can be added later. Furthermore, the driver is just implementing basic support for capturing data. Additional features like interrupts, CRC, etc. can be added later. Also, FYI, this driver will also be used as the base for an upcoming series adding AXI SPI Engine offload support for these chips along with [1]. This work is being done by BayLibre and on behalf of Analog Devices Inc. hence the maintainers are @analog.com. [1]: https://lore.kernel.org/linux-spi/20231204-axi-spi-engine-series-2-v1-0-063672323fce@baylibre.com/ --- Changes in v3: - dt-bindings: - Picked up Conor's Reviewed-By on the adi,ad7380 bindings - driver: - Removed extra indent in DEFINE_AD7380_DIFFERENTIAL_2_CHANNEL macro - Removed scan mask that included timestamp channel - Removed parent device assignment - Picked up Nuno's Reviewed-by - Link to v2: https://lore.kernel.org/r/20231213-ad7380-mainline-v2-0-cd32150d84a3@baylibre.com Changes in v2: - dt-bindings: - Added new patch with generic spi-rx-bus-channels property - Added maxItems to reg property - Replaced adi,sdo-mode property with spi-rx-bus-channels - Made spi-rx-bus-channels property optional with default value of 1 (this made the if: check more complex) - Changed example to use gpio for interrupt - driver: - Fixed CONFIG_AD7380 in Makefile - rx_buf = st->scan_data.raw instead of rx_buf = &st->scan_data - Moved iio_push_to_buffers_with_timestamp() outside of if statement - Removed extra blank lines - Renamed regulator disable function - Dropped checking of adi,sdo-mode property (regardless of the actual wiring, we can always use 1-wire mode) - Added available_scan_masks - Added check for missing driver match data - Link to v1: https://lore.kernel.org/r/20231208-ad7380-mainline-v1-0-2b33fe2f44ae@baylibre.com --- David Lechner (3): dt-bindings: spi: add spi-rx-bus-channels peripheral property dt-bindings: iio: adc: Add binding for AD7380 ADCs iio: adc: ad7380: new driver for AD7380 ADCs .../devicetree/bindings/iio/adc/adi,ad7380.yaml | 107 +++++ .../bindings/spi/spi-peripheral-props.yaml | 12 + MAINTAINERS | 10 + drivers/iio/adc/Kconfig | 16 + drivers/iio/adc/Makefile | 1 + drivers/iio/adc/ad7380.c | 462 +++++++++++++++++++++ 6 files changed, 608 insertions(+) --- base-commit: 18f78b5e609b19b56237f0dae47068d44b8b0ecd change-id: 20231208-ad7380-mainline-e6c4fa7dbedd