Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2164185lqp; Sun, 24 Mar 2024 06:11:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVQZyIqjhrOGdV8qoQM9VEHs3Luj5gvhxm5CHcKZY5zgQqWBmlaZbyl6OzxY9tYK/n+ReY8R/8PsuFU5IoGptc0Widi5kv9nVGv6tPX0A== X-Google-Smtp-Source: AGHT+IEq7QOdn6KWg+wjGd/+PPxhS+0lFj0FCEwaXrUc/FQkIv2VZ4v1ZrFL10g2MQ5JGDl+AxE1 X-Received: by 2002:a05:6a20:1b26:b0:1a3:1972:450e with SMTP id ch38-20020a056a201b2600b001a31972450emr4431485pzb.50.1711285889055; Sun, 24 Mar 2024 06:11:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711285889; cv=pass; d=google.com; s=arc-20160816; b=musOSLYaGM5KFgTCKMJrmjFZHUI6YWp6eE2PY4NLoQacdpetfwapZyDUMD2TWiS3lm XGnaKSPQMuOmvJWB7q56c5LqDSz9yHHFShSM8sqV98kfHAURILawmkISJ1aLW1altaN0 Gx8mUThG9QcYg9C5u/sioDnV3bx1varVsYbxcnLyt9FAo+5Lpe+ClwMmO/Jy3sYj2nXP Qd3Aj7W+uMz4ieZX5zNAmQZvHU1/zs9/yvszGEtaiSWgZtj8TOo17f7BiQELGwbECU+b vEKdOecW30DbCnyoMJ93DdvkK8X/1X4qZ/N4S8JY6a2H9YOXDjLz6wDtGMDiRVtDZHhJ y6Fw== 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:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=mAooNVpc9W+1W3AqUIrn2hHjzQt6x8n3n9ClmXsVK4o=; fh=MyNZIgpx1MSNRB2sApNtUWYmWkOO0A8hUBu4tnLlvBw=; b=f4SQvPqpY2Vz3+wriXm5AwUqXoN9K5eBc1WW9+3Dmyw9DBp7zusHkoydPJdN6fwdlP y36mfgMvpTfuR1m9d0aV9zLAlxMyb6NlbX7jeKQJvCaj/bhuvwMBS4ZAfkg74RJqSGLE T/TBeweJBRL7DksSREkIoQuWc86sT/JuNMfwTza/0ytGlj71P5EPgKnZNmUBzWIXQZjj D9YOme1YcXvtJxDX3QDstWg6qr3CmooZbsnqASiqVccnB+mAvDhZrWdatHD0x0MsAONt g00UX2HqX/1rMT27cT9pFyug+zNR+uJm7TAIKX7eifxL2L7Q6uRBmxJDDk9NWw6xKlOy ODBg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XjLKRn1x; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-112675-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-112675-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id h16-20020a63e150000000b005e4837345a3si5985764pgk.400.2024.03.24.06.11.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 06:11:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-112675-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XjLKRn1x; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-112675-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-112675-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 5EF7AB20EAC for ; Sun, 24 Mar 2024 13:11:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AA31517BD8; Sun, 24 Mar 2024 13:11:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XjLKRn1x" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AE0E91772D; Sun, 24 Mar 2024 13:11:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711285876; cv=none; b=qE7/D0fYCNNzGwIeAFzPTPIT44R9TYd12sPFqHy0auS97En+2Hv3nOAL6BC/Ws9duuWmXvhzVhGTpVTvGnAv1HRBdgU16dNRpu1CG9jCr/WGfeKQi7glifAjSu4RuhywcV6EBN0weq0GJzUjUaOibbsx0OZe8K1Fusca2hXHXfQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711285876; c=relaxed/simple; bh=Mrhs9/64lK3MIk0Y2r222aZ7KcyPKnhX4bA5v7W7xec=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tOLs2KPMjtiRr+dBIeM5yHT8UdBZf4PKIz/NXu7fXFO64ADISzEYcPFr2P3G7yreh05kZbMxKWCYUuFIGdmqEV2Nyw/tBMruqg9ydA0374L2FGFe+YKgldCMOrCjfN/i4Avr++ZCb13EgwSWLFWYoRCUguxtZ0R6Bd4qsXonnhw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XjLKRn1x; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0B4AC433F1; Sun, 24 Mar 2024 13:11:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711285876; bh=Mrhs9/64lK3MIk0Y2r222aZ7KcyPKnhX4bA5v7W7xec=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=XjLKRn1xrTDLsZ7nqB7UHhmIy25hy9QM3bZUTY8hJnt0+Jn/obTvwV80qwr38sHsk UIrkAmBql5fCmJmt4UQ3UP2hqEB9o2GPp/NvxA/Th7GYBuztNr+zGd2jhp8G5VVqQ+ C0QR/VQ8L5GBdQ5lDiAYtHro1RGHHNpTG0n/Q6dQBXrKBbsmo7YnQ6Mp5ix7goHD3r aWsVfMyzr84Dz60q+/SHxdzuTzL54PbteCQ962OVn9gogRARmxcEa+r9gMb9XBasOx iwSLrfJf5Y7X8GyioyvGbP/3XqnFRSSd7EHN968L7k0dHY5dpKuhAM4bR5am5hH39w zXomcL3C3bPWw== Date: Sun, 24 Mar 2024 13:10:59 +0000 From: Jonathan Cameron To: Julien Stephan Cc: Lars-Peter Clausen , Michael Hennerich , Nuno =?UTF-8?B?U8Oh?= , David Lechner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Mark Brown , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, kernel test robot Subject: Re: [PATCH v5 7/7] iio: adc: ad7380: add support for ad738x-4 4 channels variants Message-ID: <20240324131059.77fa8e68@jic23-huawei> In-Reply-To: <20240319-adding-new-ad738x-driver-v5-7-ce7df004ceb3@baylibre.com> References: <20240319-adding-new-ad738x-driver-v5-0-ce7df004ceb3@baylibre.com> <20240319-adding-new-ad738x-driver-v5-7-ce7df004ceb3@baylibre.com> X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-pc-linux-gnu) 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=US-ASCII Content-Transfer-Encoding: 7bit On Tue, 19 Mar 2024 11:11:28 +0100 Julien Stephan wrote: > Add support for ad7380/1/2/3-4 parts which are 4 channels > variants from ad7380/1/2/3 > > Signed-off-by: Julien Stephan This and other patches I didn't comment on all look good to me. So just those minor few bits and bobs for v6 and I'll pick this up if nothing else comes in. Thanks, Jonathan > --- > drivers/iio/adc/ad7380.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 74 insertions(+), 1 deletion(-) > > diff --git a/drivers/iio/adc/ad7380.c b/drivers/iio/adc/ad7380.c > index 3aca41ce9a14..cf9d2ace5f20 100644 > --- a/drivers/iio/adc/ad7380.c > +++ b/drivers/iio/adc/ad7380.c > @@ -8,6 +8,9 @@ > * Datasheets of supported parts: > * ad7380/1 : https://www.analog.com/media/en/technical-documentation/data-sheets/AD7380-7381.pdf > * ad7383/4 : https://www.analog.com/media/en/technical-documentation/data-sheets/ad7383-7384.pdf > + * ad7380-4 : https://www.analog.com/media/en/technical-documentation/data-sheets/ad7380-4.pdf > + * ad7381-4 : https://www.analog.com/media/en/technical-documentation/data-sheets/ad7381-4.pdf > + * ad7383/4-4 : https://www.analog.com/media/en/technical-documentation/data-sheets/ad7383-4-ad7384-4.pdf > */ > > #include > @@ -29,7 +32,7 @@ > #include > #include > > -#define MAX_NUM_CHANNELS 2 > +#define MAX_NUM_CHANNELS 4 > /* 2.5V internal reference voltage */ > #define AD7380_INTERNAL_REF_MV 2500 > > @@ -106,27 +109,53 @@ static const struct iio_chan_spec name[] = { \ > IIO_CHAN_SOFT_TIMESTAMP(2), \ > } > > +#define DEFINE_AD7380_4_CHANNEL(name, bits, diff) \ > +static const struct iio_chan_spec name[] = { \ > + AD7380_CHANNEL(0, bits, diff), \ > + AD7380_CHANNEL(1, bits, diff), \ > + AD7380_CHANNEL(2, bits, diff), \ > + AD7380_CHANNEL(3, bits, diff), \ > + IIO_CHAN_SOFT_TIMESTAMP(4), \ > +} > + > /* fully differential */ > DEFINE_AD7380_2_CHANNEL(ad7380_channels, 16, 1); > DEFINE_AD7380_2_CHANNEL(ad7381_channels, 14, 1); > +DEFINE_AD7380_4_CHANNEL(ad7380_4_channels, 16, 1); > +DEFINE_AD7380_4_CHANNEL(ad7381_4_channels, 14, 1); > /* pseudo differential */ > DEFINE_AD7380_2_CHANNEL(ad7383_channels, 16, 0); > DEFINE_AD7380_2_CHANNEL(ad7384_channels, 14, 0); > +DEFINE_AD7380_4_CHANNEL(ad7383_4_channels, 16, 0); > +DEFINE_AD7380_4_CHANNEL(ad7384_4_channels, 14, 0); > > static const char * const ad7380_2_channel_vcm_supplies[] = { > "aina", "ainb", > }; > > +static const char * const ad7380_4_channel_vcm_supplies[] = { > + "aina", "ainb", "ainc", "aind", > +}; > + > /* Since this is simultaneous sampling, we don't allow individual channels. */ > static const unsigned long ad7380_2_channel_scan_masks[] = { > GENMASK(1, 0), > 0 > }; > > +static const unsigned long ad7380_4_channel_scan_masks[] = { > + GENMASK(3, 0), > + 0 > +}; > + > static const struct ad7380_timing_specs ad7380_timing = { > .t_csh_ns = 10, > }; > > +static const struct ad7380_timing_specs ad7380_4_timing = { > + .t_csh_ns = 20, > +}; > + > static const struct ad7380_chip_info ad7380_chip_info = { > .name = "ad7380", > .channels = ad7380_channels, > @@ -163,6 +192,42 @@ static const struct ad7380_chip_info ad7384_chip_info = { > .timing_specs = &ad7380_timing, > }; > > +static const struct ad7380_chip_info ad7380_4_chip_info = { > + .name = "ad7380-4", > + .channels = ad7380_4_channels, > + .num_channels = ARRAY_SIZE(ad7380_4_channels), > + .available_scan_masks = ad7380_4_channel_scan_masks, > + .timing_specs = &ad7380_4_timing, > +}; > + > +static const struct ad7380_chip_info ad7381_4_chip_info = { > + .name = "ad7381-4", > + .channels = ad7381_4_channels, > + .num_channels = ARRAY_SIZE(ad7381_4_channels), > + .available_scan_masks = ad7380_4_channel_scan_masks, > + .timing_specs = &ad7380_4_timing, > +}; > + > +static const struct ad7380_chip_info ad7383_4_chip_info = { > + .name = "ad7383-4", > + .channels = ad7383_4_channels, > + .num_channels = ARRAY_SIZE(ad7383_4_channels), > + .vcm_supplies = ad7380_4_channel_vcm_supplies, > + .num_vcm_supplies = ARRAY_SIZE(ad7380_4_channel_vcm_supplies), > + .available_scan_masks = ad7380_4_channel_scan_masks, > + .timing_specs = &ad7380_4_timing, > +}; > + > +static const struct ad7380_chip_info ad7384_4_chip_info = { > + .name = "ad7384-4", > + .channels = ad7384_4_channels, > + .num_channels = ARRAY_SIZE(ad7384_4_channels), > + .vcm_supplies = ad7380_4_channel_vcm_supplies, > + .num_vcm_supplies = ARRAY_SIZE(ad7380_4_channel_vcm_supplies), > + .available_scan_masks = ad7380_4_channel_scan_masks, > + .timing_specs = &ad7380_4_timing, > +}; > + > struct ad7380_state { > const struct ad7380_chip_info *chip_info; > struct spi_device *spi; > @@ -514,6 +579,10 @@ static const struct of_device_id ad7380_of_match_table[] = { > { .compatible = "adi,ad7381", .data = &ad7381_chip_info }, > { .compatible = "adi,ad7383", .data = &ad7383_chip_info }, > { .compatible = "adi,ad7384", .data = &ad7384_chip_info }, > + { .compatible = "adi,ad7380-4", .data = &ad7380_4_chip_info }, > + { .compatible = "adi,ad7381-4", .data = &ad7381_4_chip_info }, > + { .compatible = "adi,ad7383-4", .data = &ad7383_4_chip_info }, > + { .compatible = "adi,ad7384-4", .data = &ad7384_4_chip_info }, > { } > }; > > @@ -522,6 +591,10 @@ static const struct spi_device_id ad7380_id_table[] = { > { "ad7381", (kernel_ulong_t)&ad7381_chip_info }, > { "ad7383", (kernel_ulong_t)&ad7383_chip_info }, > { "ad7384", (kernel_ulong_t)&ad7384_chip_info }, > + { "ad7380-4", (kernel_ulong_t)&ad7380_4_chip_info }, > + { "ad7381-4", (kernel_ulong_t)&ad7381_4_chip_info }, > + { "ad7383-4", (kernel_ulong_t)&ad7383_4_chip_info }, > + { "ad7384-4", (kernel_ulong_t)&ad7384_4_chip_info }, > { } > }; > MODULE_DEVICE_TABLE(spi, ad7380_id_table); >