From nobody Sun Feb 8 19:25:10 2026 Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) (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 728B616C87B for ; Mon, 19 Aug 2024 14:11:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724076715; cv=none; b=cok1CF6nfBNgpT6dP5OO1/91Dbe12aKW8V2YRl8PmmbHU+OwApzwjVBhaxMBalmhf9aMUuXNt5CM0ucaN43vNKq+ciOtBrVCAmPqo4DGdyGaoiFduoKO+7f0Li4Q0y2BgbJxaQyXl5C1/fEpTr3E6jEWAHYD3ywxzuFs7GNFdP8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724076715; c=relaxed/simple; bh=C8n6al0UQHRK5+RU6bfx1TRuStxVMF1ocwSi47nH5Tg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ESat/rDD8e/Cibst7+IzQB9SrrH7gDMZik5exIBgBp7bPh9nastlPj98xvLBFwpF+/g/uP7L0PQKMPZ3M3C/YeUFM3BntKgoGEJAL8Xn7iMTf767PI9VcLFEQ7O3ZXXeSIZmsQMD4TvtemR585CwdxB0pUOffVw8YiLCCOAOzhU= 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=hcOwyAbA; arc=none smtp.client-ip=209.85.222.175 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="hcOwyAbA" Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-7a35eff1d06so308898185a.0 for ; Mon, 19 Aug 2024 07:11:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1724076712; x=1724681512; 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=fXNNTNSx46SE+zZh2rt7jOj3EPKkFSdZlt64/WcUGsY=; b=hcOwyAbAFIWRWdcp1040seH4iBroVJxPygcACWxbH25u6hPWene4ZHam9NfQdoJkdi 8sPiUSYjqke+sRjhK7sNdS35K9ftlkCBkDVKHiigi2/Jb3dag6muvxukI1mezLhwgmHy xu0qLudfRcZdkPMcrUcHmIzV1La6m412bK4YtSYU2tBhPo3nkrL822QgOE6rl/pArWzj wfxWShrWzuqDMN9A+Y+c5eLZqRxHA9RSEU09e/Sqi+f95p5up+SNbqHcc+tt7B/L/o3f YCnCpx5/AHHJ374c4rRGKdUq/Fibc5nNyLTKCpYhVKUSHNFuKi9m8xUARNu653XwfhFl tX6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724076712; x=1724681512; 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=fXNNTNSx46SE+zZh2rt7jOj3EPKkFSdZlt64/WcUGsY=; b=bQKR67HbfCWc3T8nfgZc00MiHB4XH1/5MvzOqgrJKxqLya54wLgtalq8KuNWWux5OF QOsnSxv5JwIYoz9qfBYPrLxiU/UZ9RfrerW2/J/tRmU9+005ReOJAR53w4XtRfredhLh d3l+B/LZFjP55AwpZTjQmvxfZjxSJZ3CE6PoRdcSu9NN2U0iHKNGf2I9TkPuOPJdZzp3 iUikOIR06EqAjQyKMuA3ZUiYm+R6dcU932gL3aW2qxYUWiOUI44UfSGYFk7MF9YX1CZF KvaY/SLIbETzh9+ibNMR14YbKgCUAn1odg+icYP9UD+z3dgSPSwr50f32PSFuu0JTloW zrfA== X-Forwarded-Encrypted: i=1; AJvYcCV6Ot4gnOadXx9apsfHnSQbR9w1vvZxiYDvl4y4iAzEsXTbobqZiRl5K294Kg0d7BZItGATAZacZSmwvIFVuqBdkj+FAz8afswX/vlk X-Gm-Message-State: AOJu0YyuiIiymW8gQuqRWEN5lCSZVCiX46bfqyrS5V9DYP0ekTSfhkoI 0uqb/uIARINCxdgpzZXLP42kqx3kSAhXkKLdf55vfm8XxPJkWggOkdvlAg0653s= X-Google-Smtp-Source: AGHT+IHeOmp7OwQlB723ECayQeKNOcr3tyjBqBm4/OF+5vstRaDlZy5H4OQfNQmO5viptck1XMp7Bg== X-Received: by 2002:a05:620a:44d6:b0:7a3:49dc:f084 with SMTP id af79cd13be357-7a506954c44mr1227922185a.35.1724076712103; Mon, 19 Aug 2024 07:11:52 -0700 (PDT) Received: from [127.0.1.1] (d24-150-219-207.home.cgocable.net. [24.150.219.207]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-454c0186bf4sm17630871cf.83.2024.08.19.07.11.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2024 07:11:51 -0700 (PDT) From: Trevor Gamblin Date: Mon, 19 Aug 2024 10:11:43 -0400 Subject: [PATCH v3 1/3] dt-bindings: iio: adc: add AD762x/AD796x ADCs 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: <20240819-ad7625_r1-v3-1-75d5217c76b5@baylibre.com> References: <20240819-ad7625_r1-v3-0-75d5217c76b5@baylibre.com> In-Reply-To: <20240819-ad7625_r1-v3-0-75d5217c76b5@baylibre.com> To: Lars-Peter Clausen , Michael Hennerich , =?utf-8?q?Nuno_S=C3=A1?= , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Corbet , David Lechner , Uwe Kleine-Konig Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Trevor Gamblin X-Mailer: b4 0.14.1 Add a binding specification for the Analog Devices Inc. AD7625, AD7626, AD7960, and AD7961 ADCs. Signed-off-by: Trevor Gamblin Reviewed-by: Conor Dooley --- .../devicetree/bindings/iio/adc/adi,ad7625.yaml | 176 +++++++++++++++++= ++++ MAINTAINERS | 9 ++ 2 files changed, 185 insertions(+) diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7625.yaml b/Do= cumentation/devicetree/bindings/iio/adc/adi,ad7625.yaml new file mode 100644 index 000000000000..8848562af28f --- /dev/null +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7625.yaml @@ -0,0 +1,176 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/adc/adi,ad7625.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Analog Devices Fast PulSAR Analog to Digital Converters + +maintainers: + - Michael Hennerich + - Nuno S=C3=A1 + +description: | + A family of single channel differential analog to digital converters. + + * https://www.analog.com/en/products/ad7625.html + * https://www.analog.com/en/products/ad7626.html + * https://www.analog.com/en/products/ad7960.html + * https://www.analog.com/en/products/ad7961.html + +properties: + compatible: + enum: + - adi,ad7625 + - adi,ad7626 + - adi,ad7960 + - adi,ad7961 + + vdd1-supply: true + vdd2-supply: true + vio-supply: true + + ref-supply: + description: + Voltage regulator for the external reference voltage (REF). + + refin-supply: + description: + Voltage regulator for the reference buffer input (REFIN). + + clocks: + description: + The clock connected to the CLK pins, gated by the clk_gate PWM. + maxItems: 1 + + pwms: + items: + - description: PWM connected to the CNV input on the ADC. + - description: PWM that gates the clock connected to the ADC's CLK i= nput. + + pwm-names: + items: + - const: cnv + - const: clk_gate + + io-backends: + description: + The AXI ADC IP block connected to the D+/- and DCO+/- lines of the + ADC. An example backend can be found at + http://analogdevicesinc.github.io/hdl/projects/pulsar_lvds/index.htm= l. + maxItems: 1 + + adi,no-dco: + $ref: /schemas/types.yaml#/definitions/flag + description: + Indicates the wiring of the DCO+/- lines. If true, then they are + grounded and the device is in self-clocked mode. If this is not + present, then the device is in echoed clock mode. + + adi,en0-always-on: + $ref: /schemas/types.yaml#/definitions/flag + description: + Indicates if EN0 is hard-wired to the high state. If neither this + nor en0-gpios are present, then EN0 is hard-wired low. + + adi,en1-always-on: + $ref: /schemas/types.yaml#/definitions/flag + description: + Indicates if EN1 is hard-wired to the high state. If neither this + nor en1-gpios are present, then EN1 is hard-wired low. + + adi,en2-always-on: + $ref: /schemas/types.yaml#/definitions/flag + description: + Indicates if EN2 is hard-wired to the high state. If neither this + nor en2-gpios are present, then EN2 is hard-wired low. + + adi,en3-always-on: + $ref: /schemas/types.yaml#/definitions/flag + description: + Indicates if EN3 is hard-wired to the high state. If neither this + nor en3-gpios are present, then EN3 is hard-wired low. + + en0-gpios: + description: + Configurable EN0 pin. + + en1-gpios: + description: + Configurable EN1 pin. + + en2-gpios: + description: + Configurable EN2 pin. + + en3-gpios: + description: + Configurable EN3 pin. + +required: + - compatible + - vdd1-supply + - vdd2-supply + - vio-supply + - clocks + - pwms + - pwm-names + - io-backends + +allOf: + - if: + required: + - ref-supply + then: + properties: + refin-supply: false + - if: + required: + - refin-supply + then: + properties: + ref-supply: false + - if: + properties: + compatible: + contains: + enum: + - adi,ad7625 + - adi,ad7626 + then: + properties: + en2-gpios: false + en3-gpios: false + adi,en2-always-on: false + adi,en3-always-on: false + + - if: + properties: + compatible: + contains: + enum: + - adi,ad7960 + - adi,ad7961 + then: + # ad796x parts must have one of the two supplies + oneOf: + - required: [ref-supply] + - required: [refin-supply] + +additionalProperties: false + +examples: + - | + #include + adc { + compatible =3D "adi,ad7625"; + vdd1-supply =3D <&supply_5V>; + vdd2-supply =3D <&supply_2_5V>; + vio-supply =3D <&supply_2_5V>; + io-backends =3D <&axi_adc>; + clocks =3D <&ref_clk>; + pwms =3D <&axi_pwm_gen 0 0>, <&axi_pwm_gen 1 0>; + pwm-names =3D "cnv", "clk_gate"; + en0-gpios =3D <&gpio0 86 GPIO_ACTIVE_HIGH>; + en1-gpios =3D <&gpio0 87 GPIO_ACTIVE_HIGH>; + }; diff --git a/MAINTAINERS b/MAINTAINERS index 42decde38320..2361f92751dd 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1260,6 +1260,15 @@ F: Documentation/devicetree/bindings/iio/addac/adi,a= d74413r.yaml F: drivers/iio/addac/ad74413r.c F: include/dt-bindings/iio/addac/adi,ad74413r.h =20 +ANALOG DEVICES INC AD7625 DRIVER +M: Michael Hennerich +M: Nuno S=C3=A1 +R: Trevor Gamblin +S: Supported +W: https://ez.analog.com/linux-software-drivers +W: http://analogdevicesinc.github.io/hdl/projects/pulsar_lvds/index.html +F: Documentation/devicetree/bindings/iio/adc/adi,ad7625.yaml + ANALOG DEVICES INC AD7768-1 DRIVER M: Michael Hennerich L: linux-iio@vger.kernel.org --=20 2.39.2 From nobody Sun Feb 8 19:25:10 2026 Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) (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 D47FF16CD10 for ; Mon, 19 Aug 2024 14:11:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724076718; cv=none; b=dXhw+DSdSN6t2+1f4hXDk/kL97zwmiJXWF1Uy0eHvO8lVkN45OGnfuv7bz0JwPYpbLYnbC4CvVlC43ZrwWI5lm2yYZf0vghnnCbBUHgeC+CeLou44tsCcwFWT9n6X9TBr26yBgrT4TrYkWRFKayRtik7QJt4H7yuhTGnr2JuFyw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724076718; c=relaxed/simple; bh=oww0a7G82Vd75ByBb5Q7ebQCJInma1hwiT7+KxQwPY0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NrX+XE8b+HoMJ0m3kV7rlXRScUL9t/hxvqkCCY9ASLyHm3RfhT6tJQ64WRuijO9kpVQn9EDGxzVk+zM+BzoONWSwe0KrF0WJZpt/dO6GnugEj3/OaXz88XbITfcj2S6dcjZPn219/HmycVfoHuEvVj5yryHxgTq9nj+apfuesAM= 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=MBESRHli; arc=none smtp.client-ip=209.85.160.176 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="MBESRHli" Received: by mail-qt1-f176.google.com with SMTP id d75a77b69052e-44fe6672297so25857741cf.1 for ; Mon, 19 Aug 2024 07:11:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1724076714; x=1724681514; 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=PxuHSfxj6BDBHAYOW+Ar8FckHNsRnM9Jp6mgzbqvrXw=; b=MBESRHlij4FzH4YPpUjD26tp6i5w9MtAuN25kDYmuoIZ2JUIdOyz+vow1s/Tb2UUhW z+FMBR7hP7FdpRTu22QXt5L4DRBY9Z79WNr6dbTdBXAFxkNzg5Tpm802dY74zZzmp4f8 v0HgLzUXc+5hHAfjnczDitM2ME/4xwmDy3cwbU+08UjZNxDs38SfTFeoxtCcyzK4SL05 WYWC6zOjINPpgSmrVU36T2dnatS2ClTC5A3jBD/txxeWPD03XhdZ0MkCajIyofqXm26Z id1KomY/Ow/1VjOFJrLUrXltvL0uKzLpdDFUZTczLoGMH+1v9WfwH1PffmRF54B/NYhF o/Jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724076714; x=1724681514; 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=PxuHSfxj6BDBHAYOW+Ar8FckHNsRnM9Jp6mgzbqvrXw=; b=I/KlKloojFuPkf8AlteGNn9IwUgWMAcTWECuFZ7+NW1DIy26hW45SePyT2Nx8xz5A6 RRFAdrzBT+UTPbOdT7K2GKNe+KgP192jQhCGhQBO7/HLEc4VDLgXE6d5hlZbEQyNvLZ1 Yn6PRkMFKhKRrpIxt5/6L3aD+S4SzHqZ1ASq9RSqj1ID3hGZERjNZFj01wJDxG7mIQSw 1qYvadU8NiajyheUPY96Gjfzr0IfbnwMbDxFNc6p6cIRw4BJELhWmXNdaIBeIoh3AxvS x+JRmv2ur7SozgKM0xZ1KQofeOW6cyWHP4ljVV03Vo8sXQiIUgdbuOfb/hIrpcsOodJP rdKw== X-Forwarded-Encrypted: i=1; AJvYcCUYbrc3wzzBvBQNKb9WuhpKQ4aBlopYk/K4Gf7d+UAcOrCYf4vqUh5oKNQozNMTzacbCIpY6APatiDy3dPAB+UViyG5byRftXfEHxDS X-Gm-Message-State: AOJu0YwML9xZyeE935X7SzRxXBkg4lAmZ+gDUYQi9WYSsor8B7an7XOO zWCOSnFPTI1znu9EMieqx1nOoix/10hMWZL+LC3t1KxJ61E7xDSSyYOoIXduYk8= X-Google-Smtp-Source: AGHT+IH9n4OiVaXy0yBPK7Zx1mE24TRbLscDCleKz/Tal31mKdVBxXldjRfnIhIizvbAhwQb5mtlIw== X-Received: by 2002:a05:622a:418c:b0:453:4aaa:d585 with SMTP id d75a77b69052e-453741b4af7mr131441171cf.4.1724076713423; Mon, 19 Aug 2024 07:11:53 -0700 (PDT) Received: from [127.0.1.1] (d24-150-219-207.home.cgocable.net. [24.150.219.207]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-454c0186bf4sm17630871cf.83.2024.08.19.07.11.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2024 07:11:53 -0700 (PDT) From: Trevor Gamblin Date: Mon, 19 Aug 2024 10:11:44 -0400 Subject: [PATCH v3 2/3] iio: adc: ad7625: add driver 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: <20240819-ad7625_r1-v3-2-75d5217c76b5@baylibre.com> References: <20240819-ad7625_r1-v3-0-75d5217c76b5@baylibre.com> In-Reply-To: <20240819-ad7625_r1-v3-0-75d5217c76b5@baylibre.com> To: Lars-Peter Clausen , Michael Hennerich , =?utf-8?q?Nuno_S=C3=A1?= , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Corbet , David Lechner , Uwe Kleine-Konig Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Trevor Gamblin X-Mailer: b4 0.14.1 Add a driver for the AD762x and AD796x family of ADCs. These are pin-compatible devices using an LVDS interface for data transfer, capable of sampling at rates of 6 (AD7625), 10 (AD7626), and 5 (AD7960/AD7961) MSPS, respectively. They also feature multiple voltage reference options based on the configuration of the EN1/EN0 pins, which can be set in the devicetree. Signed-off-by: Trevor Gamblin --- MAINTAINERS | 1 + drivers/iio/adc/Kconfig | 15 ++ drivers/iio/adc/Makefile | 1 + drivers/iio/adc/ad7625.c | 688 +++++++++++++++++++++++++++++++++++++++++++= ++++ 4 files changed, 705 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 2361f92751dd..a90972e1c5c5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1268,6 +1268,7 @@ S: Supported W: https://ez.analog.com/linux-software-drivers W: http://analogdevicesinc.github.io/hdl/projects/pulsar_lvds/index.html F: Documentation/devicetree/bindings/iio/adc/adi,ad7625.yaml +F: drivers/iio/adc/ad7625.c =20 ANALOG DEVICES INC AD7768-1 DRIVER M: Michael Hennerich diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index f60fe85a30d5..e25fb505f545 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -219,6 +219,21 @@ config AD7606_IFACE_SPI To compile this driver as a module, choose M here: the module will be called ad7606_spi. =20 +config AD7625 + tristate "Analog Devices AD7625/AD7626 High Speed ADC driver" + select IIO_BACKEND + help + Say yes here to build support for Analog Devices: + * AD7625 16-Bit, 6 MSPS PulSAR Analog-to-Digital Converter + * AD7626 16-Bit, 10 MSPS PulSAR Analog-to-Digital Converter + * AD7960 18-Bit, 5 MSPS PulSAR Analog-to-Digital Converter + * AD7961 16-Bit, 5 MSPS PulSAR Analog-to-Digital Converter + + The driver requires the assistance of the AXI ADC IP core to ope= rate. + + To compile this driver as a module, choose M here: the module wi= ll be + called ad7625. + config AD7766 tristate "Analog Devices AD7766/AD7767 ADC driver" depends on SPI_MASTER diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index d370e066544e..6bf429ca24ea 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -23,6 +23,7 @@ obj-$(CONFIG_AD7476) +=3D ad7476.o obj-$(CONFIG_AD7606_IFACE_PARALLEL) +=3D ad7606_par.o obj-$(CONFIG_AD7606_IFACE_SPI) +=3D ad7606_spi.o obj-$(CONFIG_AD7606) +=3D ad7606.o +obj-$(CONFIG_AD7625) +=3D ad7625.o obj-$(CONFIG_AD7766) +=3D ad7766.o obj-$(CONFIG_AD7768_1) +=3D ad7768-1.o obj-$(CONFIG_AD7780) +=3D ad7780.o diff --git a/drivers/iio/adc/ad7625.c b/drivers/iio/adc/ad7625.c new file mode 100644 index 000000000000..3ac3c56d43eb --- /dev/null +++ b/drivers/iio/adc/ad7625.c @@ -0,0 +1,688 @@ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) +/* + * Analog Devices Inc. AD7625 ADC driver + * + * Copyright 2024 Analog Devices Inc. + * Copyright 2024 BayLibre, SAS + * + * Note that this driver requires the AXI ADC IP block configured for + * LVDS to function. See Documentation/iio/ad7625.rst for more + * information. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define AD7625_INTERNAL_REF_MV 4096 +#define AD7960_MAX_NBW_FREQ (2 * MEGA) + +struct ad7625_timing_spec { + /* Max conversion high time (t_{CNVH}). */ + unsigned int conv_high_ns; + /* Max conversion to MSB delay (t_{MSB}). */ + unsigned int conv_msb_ns; +}; + +struct ad7625_chip_info { + const char *name; + const unsigned int max_sample_rate_hz; + const struct ad7625_timing_spec *timing_spec; + const struct iio_chan_spec chan_spec; + const bool has_power_down_state; + const bool has_bandwidth_control; + const bool has_internal_vref; +}; + +/* AD7625_CHAN_SPEC - Define a chan spec structure for a specific chip */ +#define AD7625_CHAN_SPEC(_bits) { \ + .type =3D IIO_VOLTAGE, \ + .indexed =3D 1, \ + .differential =3D 1, \ + .channel =3D 0, \ + .channel2 =3D 1, \ + .info_mask_separate =3D BIT(IIO_CHAN_INFO_SCALE), \ + .info_mask_shared_by_all =3D BIT(IIO_CHAN_INFO_SAMP_FREQ), \ + .scan_index =3D 0, \ + .scan_type.sign =3D 's', \ + .scan_type.storagebits =3D (_bits) > 16 ? 32 : 16, \ + .scan_type.realbits =3D (_bits), \ +} + +struct ad7625_state { + const struct ad7625_chip_info *info; + struct iio_backend *back; + /* rate of the clock gated by the "clk_gate" PWM */ + unsigned long ref_clk_rate_hz; + /* PWM burst signal for transferring acquired data to the host */ + struct pwm_device *clk_gate_pwm; + /* + * PWM control signal for initiating data conversion. Analog + * inputs are sampled beginning on this signal's rising edge. + */ + struct pwm_device *cnv_pwm; + /* + * Waveforms containing the last-requested and rounded + * properties for the clk_gate and cnv PWMs + */ + struct pwm_waveform clk_gate_wf; + struct pwm_waveform cnv_wf; + unsigned int vref_mv; + int sampling_freq_hz; + /* + * Optional GPIOs for controlling device state. EN0 and EN1 + * determine voltage reference configuration and on/off state. + * EN2 controls the device -3dB bandwidth (and by extension, max + * sample rate). EN3 controls the VCM reference output. EN2 and + * EN3 are only present for the AD796x devices. + */ + struct gpio_desc *en_gpios[4]; + bool can_power_down; + bool can_refin; + bool can_ref_4v096; + /* + * Indicate whether the bandwidth can be narrow (9MHz). + * When true, device sample rate must also be < 2MSPS. + */ + bool can_narrow_bandwidth; + /* Indicate whether the bandwidth can be wide (28MHz). */ + bool can_wide_bandwidth; + bool can_ref_5v; + bool can_snooze; + bool can_test_pattern; + /* Indicate whether there is a REFIN supply connected */ + bool have_refin; +}; + +static const struct ad7625_timing_spec ad7625_timing_spec =3D { + .conv_high_ns =3D 40, + .conv_msb_ns =3D 145, +}; + +static const struct ad7625_timing_spec ad7626_timing_spec =3D { + .conv_high_ns =3D 40, + .conv_msb_ns =3D 80, +}; + +/* + * conv_msb_ns is set to 0 instead of the datasheet maximum of 200ns to + * avoid exceeding the minimum conversion time, i.e. it is effectively + * modulo 200 and offset by a full period. Values greater than or equal + * to the period would be rejected by the PWM API. + */ +static const struct ad7625_timing_spec ad7960_timing_spec =3D { + .conv_high_ns =3D 80, + .conv_msb_ns =3D 0, +}; + +static const struct ad7625_chip_info ad7625_chip_info =3D { + .name =3D "ad7625", + .max_sample_rate_hz =3D 6 * MEGA, + .timing_spec =3D &ad7625_timing_spec, + .chan_spec =3D AD7625_CHAN_SPEC(16), + .has_power_down_state =3D false, + .has_bandwidth_control =3D false, + .has_internal_vref =3D true, +}; + +static const struct ad7625_chip_info ad7626_chip_info =3D { + .name =3D "ad7626", + .max_sample_rate_hz =3D 10 * MEGA, + .timing_spec =3D &ad7626_timing_spec, + .chan_spec =3D AD7625_CHAN_SPEC(16), + .has_power_down_state =3D true, + .has_bandwidth_control =3D false, + .has_internal_vref =3D true, +}; + +static const struct ad7625_chip_info ad7960_chip_info =3D { + .name =3D "ad7960", + .max_sample_rate_hz =3D 5 * MEGA, + .timing_spec =3D &ad7960_timing_spec, + .chan_spec =3D AD7625_CHAN_SPEC(18), + .has_power_down_state =3D true, + .has_bandwidth_control =3D true, + .has_internal_vref =3D false, +}; + +static const struct ad7625_chip_info ad7961_chip_info =3D { + .name =3D "ad7961", + .max_sample_rate_hz =3D 5 * MEGA, + .timing_spec =3D &ad7960_timing_spec, + .chan_spec =3D AD7625_CHAN_SPEC(16), + .has_power_down_state =3D true, + .has_bandwidth_control =3D true, + .has_internal_vref =3D false, +}; + +enum ad7960_mode { + AD7960_MODE_POWER_DOWN, + AD7960_MODE_SNOOZE, + AD7960_MODE_NARROW_BANDWIDTH, + AD7960_MODE_WIDE_BANDWIDTH, + AD7960_MODE_TEST_PATTERN, +}; + +static int ad7625_set_sampling_freq(struct ad7625_state *st, int freq) +{ + u64 target; + struct pwm_waveform clk_gate_wf =3D { }, cnv_wf =3D { }; + int ret; + + target =3D DIV_ROUND_UP_ULL(NSEC_PER_SEC, freq); + cnv_wf.period_length_ns =3D clamp(target, 100, 10 * KILO); + + /* + * Use the maximum conversion time t_CNVH from the datasheet as + * the duty_cycle for ref_clk, cnv, and clk_gate + */ + cnv_wf.duty_length_ns =3D st->info->timing_spec->conv_high_ns; + + ret =3D pwm_round_waveform_might_sleep(st->cnv_pwm, &cnv_wf); + if (ret) + return ret; + + /* + * Set up the burst signal for transferring data. period and + * offset should mirror the CNV signal + */ + clk_gate_wf.period_length_ns =3D cnv_wf.period_length_ns; + + clk_gate_wf.duty_length_ns =3D DIV_ROUND_UP_ULL((u64)NSEC_PER_SEC * + st->info->chan_spec.scan_type.realbits, + st->ref_clk_rate_hz); + + /* max t_MSB from datasheet */ + clk_gate_wf.duty_offset_ns =3D st->info->timing_spec->conv_msb_ns; + + ret =3D pwm_round_waveform_might_sleep(st->clk_gate_pwm, &clk_gate_wf); + if (ret) + return ret; + + st->cnv_wf =3D cnv_wf; + st->clk_gate_wf =3D clk_gate_wf; + + /* TODO: Add a rounding API for PWMs that can simplify this */ + target =3D DIV_ROUND_CLOSEST_ULL(st->ref_clk_rate_hz, freq); + st->sampling_freq_hz =3D DIV_ROUND_CLOSEST_ULL(st->ref_clk_rate_hz, + target); + + return 0; +} + +static int ad7625_read_raw(struct iio_dev *indio_dev, + const struct iio_chan_spec *chan, + int *val, int *val2, long info) +{ + struct ad7625_state *st =3D iio_priv(indio_dev); + + switch (info) { + case IIO_CHAN_INFO_SAMP_FREQ: + *val =3D st->sampling_freq_hz; + + return IIO_VAL_INT; + + case IIO_CHAN_INFO_SCALE: + *val =3D st->vref_mv; + *val2 =3D chan->scan_type.realbits - 1; + + return IIO_VAL_FRACTIONAL_LOG2; + + default: + return -EINVAL; + } +} + +static int ad7625_write_raw(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + int val, int val2, long info) +{ + struct ad7625_state *st =3D iio_priv(indio_dev); + + switch (info) { + case IIO_CHAN_INFO_SAMP_FREQ: + iio_device_claim_direct_scoped(return -EBUSY, indio_dev) + return ad7625_set_sampling_freq(st, val); + unreachable(); + default: + return -EINVAL; + } +} + +static int ad7625_parse_mode(struct device *dev, struct ad7625_state *st, + int num_gpios) +{ + bool en_always_on[4], en_always_off[4]; + bool en_may_be_on[4], en_may_be_off[4]; + char en_gpio_buf[4]; + char always_on_buf[18]; + int i; + + for (i =3D 0; i < num_gpios; i++) { + snprintf(en_gpio_buf, sizeof(en_gpio_buf), "en%d", i); + snprintf(always_on_buf, sizeof(always_on_buf), + "adi,en%d-always-on", i); + /* Set the device to 0b0000 (power-down mode) by default */ + st->en_gpios[i] =3D devm_gpiod_get_optional(dev, en_gpio_buf, + GPIOD_OUT_LOW); + if (IS_ERR(st->en_gpios[i])) + return dev_err_probe(dev, PTR_ERR(st->en_gpios[i]), + "failed to get EN%d GPIO\n", i); + + en_always_on[i] =3D device_property_read_bool(dev, always_on_buf); + if (st->en_gpios[i] && en_always_on[i]) + return dev_err_probe(dev, -EINVAL, + "cannot have adi,en%d-always-on and en%d-gpios\n", i, i); + + en_may_be_off[i] =3D !en_always_on[i]; + en_may_be_on[i] =3D en_always_on[i] || st->en_gpios[i]; + en_always_off[i] =3D !en_always_on[i] && !st->en_gpios[i]; + } + + /* + * Power down is mode 0bXX00, but not all devices have a valid + * power down state. + */ + st->can_power_down =3D en_may_be_off[1] && en_may_be_off[0] && + st->info->has_power_down_state; + /* + * The REFIN pin can take a 1.2V (AD762x) or 2.048V (AD796x) + * external reference when the mode is 0bXX01. + */ + st->can_refin =3D en_may_be_off[1] && en_may_be_on[0]; + /* 4.096V can be applied to REF when the EN mode is 0bXX10. */ + st->can_ref_4v096 =3D en_may_be_on[1] && en_may_be_off[0]; + + /* Avoid AD796x-specific setup if the part is an AD762x */ + if (num_gpios =3D=3D 2) + return 0; + + /* mode 0b1100 (AD796x) is invalid */ + if (en_always_on[3] && en_always_on[2] && + en_always_off[1] && en_always_off[0]) + return dev_err_probe(dev, -EINVAL, + "EN GPIOs set to invalid mode 0b1100\n"); + /* + * 5V can be applied to the AD796x REF pin when the EN mode is + * the same (0bX001 or 0bX101) as for can_refin, and REFIN is + * 0V. + */ + st->can_ref_5v =3D st->can_refin; + /* + * Bandwidth (AD796x) is controlled solely by EN2. If it's + * specified and not hard-wired, then we can configure it to + * change the bandwidth between 28MHz and 9MHz. + */ + st->can_narrow_bandwidth =3D en_may_be_on[2]; + /* Wide bandwidth mode is possible if EN2 can be 0. */ + st->can_wide_bandwidth =3D en_may_be_off[2]; + /* Snooze mode (AD796x) is 0bXX11 when REFIN =3D 0V. */ + st->can_snooze =3D en_may_be_on[1] && en_may_be_on[0]; + /* Test pattern mode (AD796x) is 0b0100. */ + st->can_test_pattern =3D en_may_be_off[3] && en_may_be_on[2] && + en_may_be_off[1] && en_may_be_off[0]; + + return 0; +} + +/* Set EN1 and EN0 based on reference voltage source */ +static void ad7625_set_en_gpios_for_vref(struct ad7625_state *st, + bool have_refin, int ref_mv) +{ + if (have_refin || ref_mv =3D=3D 5000) { + gpiod_set_value_cansleep(st->en_gpios[1], 0); + gpiod_set_value_cansleep(st->en_gpios[0], 1); + } else if (ref_mv =3D=3D 4096) { + gpiod_set_value_cansleep(st->en_gpios[1], 1); + gpiod_set_value_cansleep(st->en_gpios[0], 0); + } else { + /* + * Unreachable by AD796x, since the driver will error if + * neither REF nor REFIN is provided + */ + gpiod_set_value_cansleep(st->en_gpios[1], 1); + gpiod_set_value_cansleep(st->en_gpios[0], 1); + } +} + +static int ad7960_set_mode(struct ad7625_state *st, enum ad7960_mode mode, + bool have_refin, int ref_mv) +{ + switch (mode) { + case AD7960_MODE_POWER_DOWN: + if (!st->can_power_down) + return -EINVAL; + + gpiod_set_value_cansleep(st->en_gpios[2], 0); + gpiod_set_value_cansleep(st->en_gpios[1], 0); + gpiod_set_value_cansleep(st->en_gpios[0], 0); + + return 0; + + case AD7960_MODE_SNOOZE: + if (!st->can_snooze) + return -EINVAL; + + gpiod_set_value_cansleep(st->en_gpios[1], 1); + gpiod_set_value_cansleep(st->en_gpios[0], 1); + + return 0; + + case AD7960_MODE_NARROW_BANDWIDTH: + if (!st->can_narrow_bandwidth) + return -EINVAL; + + gpiod_set_value_cansleep(st->en_gpios[2], 1); + ad7625_set_en_gpios_for_vref(st, have_refin, ref_mv); + + return 0; + + case AD7960_MODE_WIDE_BANDWIDTH: + if (!st->can_wide_bandwidth) + return -EINVAL; + + gpiod_set_value_cansleep(st->en_gpios[2], 0); + ad7625_set_en_gpios_for_vref(st, have_refin, ref_mv); + + return 0; + + case AD7960_MODE_TEST_PATTERN: + if (!st->can_test_pattern) + return -EINVAL; + + gpiod_set_value_cansleep(st->en_gpios[3], 0); + gpiod_set_value_cansleep(st->en_gpios[2], 1); + gpiod_set_value_cansleep(st->en_gpios[1], 0); + gpiod_set_value_cansleep(st->en_gpios[0], 0); + + return 0; + + default: + return -EINVAL; + } +} + +static int ad7625_buffer_preenable(struct iio_dev *indio_dev) +{ + struct ad7625_state *st =3D iio_priv(indio_dev); + int ret; + + ret =3D pwm_set_waveform_might_sleep(st->cnv_pwm, &st->cnv_wf, false); + if (ret) + return ret; + + ret =3D pwm_set_waveform_might_sleep(st->clk_gate_pwm, + &st->clk_gate_wf, false); + if (ret) { + /* Disable cnv PWM if clk_gate setup failed */ + pwm_disable(st->cnv_pwm); + return ret; + } + + return 0; +} + +static int ad7625_buffer_postdisable(struct iio_dev *indio_dev) +{ + struct ad7625_state *st =3D iio_priv(indio_dev); + + pwm_disable(st->cnv_pwm); + pwm_disable(st->clk_gate_pwm); + + return 0; +} + +static const struct iio_info ad7625_info =3D { + .read_raw =3D ad7625_read_raw, + .write_raw =3D ad7625_write_raw, +}; + +static const struct iio_buffer_setup_ops ad7625_buffer_setup_ops =3D { + .preenable =3D &ad7625_buffer_preenable, + .postdisable =3D &ad7625_buffer_postdisable, +}; + +static int devm_ad7625_pwm_get(struct device *dev, struct clk *ref_clk, + struct ad7625_state *st) +{ + unsigned long ref_clk_rate_hz; + + st->cnv_pwm =3D devm_pwm_get(dev, "cnv"); + if (IS_ERR(st->cnv_pwm)) + return dev_err_probe(dev, PTR_ERR(st->cnv_pwm), + "failed to get cnv pwm\n"); + + /* Preemptively disable the PWM in case it was enabled at boot */ + pwm_disable(st->cnv_pwm); + + st->clk_gate_pwm =3D devm_pwm_get(dev, "clk_gate"); + if (IS_ERR(st->clk_gate_pwm)) + return dev_err_probe(dev, PTR_ERR(st->clk_gate_pwm), + "failed to get clk_gate pwm\n"); + + /* Preemptively disable the PWM in case it was enabled at boot */ + pwm_disable(st->clk_gate_pwm); + + ref_clk =3D devm_clk_get_enabled(dev, NULL); + if (IS_ERR(ref_clk)) + return dev_err_probe(dev, PTR_ERR(ref_clk), + "failed to get ref_clk"); + + ref_clk_rate_hz =3D clk_get_rate(ref_clk); + if (!ref_clk_rate_hz) + return dev_err_probe(dev, -EINVAL, + "failed to get ref_clk rate"); + + st->ref_clk_rate_hz =3D ref_clk_rate_hz; + + return 0; +} + +/* + * There are three required input voltages for each device, plus two + * conditionally-optional (depending on part) REF and REFIN voltages + * where their validity depends upon the EN pin configuration. + * + * Power-up info for the device says to bring up vio, then vdd2, then + * vdd1, so list them in that order in the regulator_names array. + * + * The reference voltage source is determined like so: + * - internal reference: neither REF or REFIN is connected (invalid for + * AD796x) + * - internal buffer, external reference: REF not connected, REFIN + * connected + * - external reference: REF connected, REFIN not connected + */ +static int devm_ad7625_regulator_setup(struct device *dev, + struct ad7625_state *st) +{ + static const char * const regulator_names[] =3D { "vio", "vdd2", "vdd1" }; + int ret, ref_mv; + + ret =3D devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(regulator_names), + regulator_names); + if (ret) + return ret; + + ret =3D devm_regulator_get_enable_read_voltage(dev, "ref"); + if (ret < 0 && ret !=3D -ENODEV) + return dev_err_probe(dev, ret, "failed to get REF voltage\n"); + + ref_mv =3D ret =3D=3D -ENODEV ? 0 : ret / 1000; + + ret =3D devm_regulator_get_enable_optional(dev, "refin"); + if (ret < 0 && ret !=3D -ENODEV) + return dev_err_probe(dev, ret, "failed to get REFIN voltage\n"); + + st->have_refin =3D ret !=3D -ENODEV; + + if (st->have_refin && !st->can_refin) + return dev_err_probe(dev, -EINVAL, + "REFIN provided in unsupported mode\n"); + + if (!st->info->has_internal_vref && !st->have_refin && !ref_mv) + return dev_err_probe(dev, -EINVAL, + "Need either REFIN or REF"); + + if (st->have_refin && ref_mv) + return dev_err_probe(dev, -EINVAL, + "cannot have both REFIN and REF supplies\n"); + + if (ref_mv =3D=3D 4096 && !st->can_ref_4v096) + return dev_err_probe(dev, -EINVAL, + "REF is 4.096V in unsupported mode\n"); + + if (ref_mv =3D=3D 5000 && !st->can_ref_5v) + return dev_err_probe(dev, -EINVAL, + "REF is 5V in unsupported mode\n"); + + st->vref_mv =3D ref_mv ?: AD7625_INTERNAL_REF_MV; + + return 0; +} + +static int ad7625_probe(struct platform_device *pdev) +{ + struct device *dev =3D &pdev->dev; + struct iio_dev *indio_dev; + struct ad7625_state *st; + struct clk *ref_clk; + int ret; + int default_sample_freq; + + indio_dev =3D devm_iio_device_alloc(dev, sizeof(*st)); + if (!indio_dev) + return -ENOMEM; + + st =3D iio_priv(indio_dev); + + st->info =3D device_get_match_data(dev); + if (!st->info) + return dev_err_probe(dev, -EINVAL, "no chip info\n"); + + if (device_property_read_bool(dev, "adi,no-dco")) + return dev_err_probe(dev, -EINVAL, + "self-clocked mode not supported\n"); + + if (st->info->has_bandwidth_control) + ret =3D ad7625_parse_mode(dev, st, 4); + else + ret =3D ad7625_parse_mode(dev, st, 2); + + if (ret) + return ret; + + ret =3D devm_ad7625_regulator_setup(dev, st); + if (ret) + return ret; + + /* Set the device mode based on detected EN configuration. */ + if (!st->info->has_bandwidth_control) { + ad7625_set_en_gpios_for_vref(st, st->have_refin, st->vref_mv); + } else { + /* + * If neither sampling mode is available, then report an error, + * since the other modes are not useful defaults. + */ + if (st->can_wide_bandwidth) { + ret =3D ad7960_set_mode(st, AD7960_MODE_WIDE_BANDWIDTH, + st->have_refin, st->vref_mv); + } else if (st->can_narrow_bandwidth) { + ret =3D ad7960_set_mode(st, AD7960_MODE_NARROW_BANDWIDTH, + st->have_refin, st->vref_mv); + } else { + return dev_err_probe(dev, -EINVAL, + "couldn't set device to wide or narrow bandwidth modes\n"); + } + + if (ret) + return dev_err_probe(dev, -EINVAL, + "failed to set EN pins\n"); + } + + ret =3D devm_ad7625_pwm_get(dev, ref_clk, st); + if (ret) + return ret; + + indio_dev->channels =3D &st->info->chan_spec; + indio_dev->num_channels =3D 1; + indio_dev->name =3D st->info->name; + indio_dev->info =3D &ad7625_info; + indio_dev->setup_ops =3D &ad7625_buffer_setup_ops; + + st->back =3D devm_iio_backend_get(dev, NULL); + if (IS_ERR(st->back)) + return dev_err_probe(dev, PTR_ERR(st->back), + "failed to get IIO backend"); + + ret =3D devm_iio_backend_request_buffer(dev, st->back, indio_dev); + if (ret) + return ret; + + ret =3D devm_iio_backend_enable(dev, st->back); + if (ret) + return ret; + + /* + * Set the initial sampling frequency to the maximum, unless the + * AD796x device is limited to narrow bandwidth by EN2 =3D=3D 1, in + * which case the sampling frequency should be limited to 2MSPS + */ + if (!st->info->has_bandwidth_control) { + default_sample_freq =3D st->info->max_sample_rate_hz; + } else { + default_sample_freq =3D !st->can_wide_bandwidth ? + AD7960_MAX_NBW_FREQ : + st->info->max_sample_rate_hz; + } + + ret =3D ad7625_set_sampling_freq(st, default_sample_freq); + if (ret) + dev_err_probe(dev, ret, + "failed to set valid sampling frequency\n"); + + return devm_iio_device_register(dev, indio_dev); +} + +static const struct of_device_id ad7625_of_match[] =3D { + { .compatible =3D "adi,ad7625", .data =3D &ad7625_chip_info }, + { .compatible =3D "adi,ad7626", .data =3D &ad7626_chip_info }, + { .compatible =3D "adi,ad7960", .data =3D &ad7960_chip_info }, + { .compatible =3D "adi,ad7961", .data =3D &ad7961_chip_info }, + { } +}; +MODULE_DEVICE_TABLE(of, ad7625_of_match); + +static const struct platform_device_id ad7625_device_ids[] =3D { + { .name =3D "ad7625", .driver_data =3D (kernel_ulong_t)&ad7625_chip_info = }, + { .name =3D "ad7626", .driver_data =3D (kernel_ulong_t)&ad7626_chip_info = }, + { .name =3D "ad7960", .driver_data =3D (kernel_ulong_t)&ad7960_chip_info = }, + { .name =3D "ad7961", .driver_data =3D (kernel_ulong_t)&ad7961_chip_info = }, + { } +}; +MODULE_DEVICE_TABLE(platform, ad7625_device_ids); + +static struct platform_driver ad7625_driver =3D { + .probe =3D ad7625_probe, + .driver =3D { + .name =3D "ad7625", + .of_match_table =3D ad7625_of_match, + }, + .id_table =3D ad7625_device_ids, +}; +module_platform_driver(ad7625_driver); + +MODULE_AUTHOR("Trevor Gamblin "); +MODULE_DESCRIPTION("Analog Devices AD7625 ADC"); +MODULE_LICENSE("Dual BSD/GPL"); +MODULE_IMPORT_NS(IIO_BACKEND); --=20 2.39.2 From nobody Sun Feb 8 19:25:10 2026 Received: from mail-ot1-f46.google.com (mail-ot1-f46.google.com [209.85.210.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 0BDF3166F21 for ; Mon, 19 Aug 2024 14:11:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724076718; cv=none; b=Cob9nwxUZeZa2hj0s57MgqGdH4RX7jf1N3dlFYaWilbL/g3OHbgpaNsmTUoWqVXHBhdBGDGHxANkwobDTYYtzresEBAOqDvGLkzFx4d6ZzzLuFSbVK1E2ItjgGhSQsAPj1s+7NdWj8ubF3jZn2tEOwuTpB4/yPJOVtgu5cZYF1Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724076718; c=relaxed/simple; bh=GKmFo3bmFk2IVwRE7ksCrTnyul2s0DsTqMziI0uIR6M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nSIchOmIcD4vCTtswi8U08/QhhoxmOjA2cvfXNqyj3HYrcZm9JyovRksh2xzSxyS0ZG6occbINT5C0q1BjG/h3NfcdWeI+jz8gDfVVFeEf5ZbyyuMW1G2Rwi9GFtHeVqbl+XvtpVgSqB4qcJFg1gteC4Wap6ESSk/JZioYoX3l4= 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=aQWOEsnR; arc=none smtp.client-ip=209.85.210.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="aQWOEsnR" Received: by mail-ot1-f46.google.com with SMTP id 46e09a7af769-70943b07c2cso2457470a34.1 for ; Mon, 19 Aug 2024 07:11:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1724076715; x=1724681515; 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=/5uzNUVmRh9vWTdDmOIKmWFbEDxFk4bBzY+xGs2C1kM=; b=aQWOEsnRVgx4NUH/d82ZLeikFMG8N6Vx0BIJui0g596QAoWdC3Ls/iwpTAKU2bSmYW my3cHwGuPpD2pBbuZtX2UFdt8M2LnBk0Ljjh9/6OFJP9ggK3j9jjhSL/BNYEEfU1wWwX 6NHXesHxeQPyU0Vl4WOyfkPHPGUwwIxCEAnoAATuGUdBcyhqg9wKcJACe6rbByQUPhWW /vfMex1RTYMT2qCHnJKZaJZi2YM2NzKUcB4ybV/NzyX+uFBuY/xuFQeItptLYVABi4tH kTWjcfh/QZUqH69O/kiW3JrImpMGqPO8yYW98ZUnDE/PYR+eLmEdOnN0ZSdCWIMs2MDl UG4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724076715; x=1724681515; 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=/5uzNUVmRh9vWTdDmOIKmWFbEDxFk4bBzY+xGs2C1kM=; b=CwGkI5kgrwA2o9+BByx/3dqaTKWnbEs1wy2Oz347RHiIwfcT+4zEi1tiA/AUVlV5E7 FnoUgMUvemBC4cqAsLTzlxu5B/VwjhsTRhpmDwwsvhdXeiujvLznU7mwKQ6Ngr3X081/ AnWsOQNaHBBAB5duDuc+ra8IHMd1vCLql/i13Fr2CkARhRFdjDMqh4IICK/6yz97VJJo fCcobbH2RYqhcFu/b2xaK1fFbK9TfA096ieOYl/57MSl2NHRJ1HtJDfQmZHY/1vRxWuA DqWO60DVp8EycKL3DoAYrYrTQvZk9yUJurduU+0pesE6Wlhtm4qpts7yDJyhO+uLXZm3 Cp8g== X-Forwarded-Encrypted: i=1; AJvYcCWdzmhmY+Jb2u40luXyfcsAqoaX/ZAgKVdXP5SCXo2sy9Qo8ryNcOAmos76sWNrgs0CLfSFIrJpZ5jqDbIOuhLluAZ6mpk9zRtHcIwO X-Gm-Message-State: AOJu0Yw/NXuQkjPW2+aCfOFee6HB7KQ9SgCND1RWSs/6VtKR/n6YSYgZ ekbh4jmxvtPwaTid8bL+sXif0McrTKk3HkZPkXJDMSUFbMEoUkyVcY+IZHkjhTI= X-Google-Smtp-Source: AGHT+IEIDxFNslUnjaNjQfcTGoFfsRx/9iiQtZEblfA8o9JXy5NKux1Ci5S8rTzmYKFjgqPFesW3cQ== X-Received: by 2002:a05:6830:92a:b0:703:6434:aba8 with SMTP id 46e09a7af769-70cac7c6020mr13267546a34.0.1724076714622; Mon, 19 Aug 2024 07:11:54 -0700 (PDT) Received: from [127.0.1.1] (d24-150-219-207.home.cgocable.net. [24.150.219.207]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-454c0186bf4sm17630871cf.83.2024.08.19.07.11.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2024 07:11:54 -0700 (PDT) From: Trevor Gamblin Date: Mon, 19 Aug 2024 10:11:45 -0400 Subject: [PATCH v3 3/3] docs: iio: new docs for ad7625 driver 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: <20240819-ad7625_r1-v3-3-75d5217c76b5@baylibre.com> References: <20240819-ad7625_r1-v3-0-75d5217c76b5@baylibre.com> In-Reply-To: <20240819-ad7625_r1-v3-0-75d5217c76b5@baylibre.com> To: Lars-Peter Clausen , Michael Hennerich , =?utf-8?q?Nuno_S=C3=A1?= , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jonathan Corbet , David Lechner , Uwe Kleine-Konig Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Trevor Gamblin X-Mailer: b4 0.14.1 Add documentation for the AD7625/AD7626/AD7960/AD7961 ADCs. Signed-off-by: Trevor Gamblin --- Documentation/iio/ad7625.rst | 91 ++++++++++++++++++++++++++++++++++++++++= ++++ MAINTAINERS | 1 + 2 files changed, 92 insertions(+) diff --git a/Documentation/iio/ad7625.rst b/Documentation/iio/ad7625.rst new file mode 100644 index 000000000000..61761e3b75c3 --- /dev/null +++ b/Documentation/iio/ad7625.rst @@ -0,0 +1,91 @@ +.. SPDX-License-Identifier: GPL-2.0-only + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +AD7625 driver +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +ADC driver for Analog Devices Inc. AD7625, AD7626, AD7960, and AD7961 +devices. The module name is ``ad7625``. + +Supported devices +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +The following chips are supported by this driver: + +* `AD7625 `_ +* `AD7626 `_ +* `AD7960 `_ +* `AD7961 `_ + +The driver requires use of the Pulsar LVDS HDL project: + +* `Pulsar LVDS HDL `_ + +To trigger conversions and enable subsequent data transfer, the devices +require coupled PWM signals with a phase offset. + +Supported features +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Conversion control modes +------------------------ + +The driver currently supports one of two possible LVDS conversion control = methods. + +Echoed-Clock interface mode +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. code-block:: + + +----------------+ + +xxxxxxxxxxxxxxxxxxxxxxxxxx| CNV | + X | | + v | HOST | + +----------------------------+ | | + | CNV+/CNV- DCO+/DCO- |xxxxxxx>| CLK_IN | + | | | | + | | | | + | AD7625 D+/D- |xxxxxxx>| DATA_IN | + | | | | + | | | | + | CLK+/CLK- |