From nobody Sun Dec 14 01:38:56 2025 Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (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 091D826B74A; Fri, 8 Aug 2025 08:51:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754643085; cv=none; b=TGXVyb/LdkvSK4hs5BpFNYbZumV6aMc5op51jOMZe1P8vTVUalUbDje6S75GsyJWLEHTIbD307NuI08GKtWSw3HE30/+rosN4EeUZYiKUtxtBoo9Lb72FicH40a4SBPKjdx+MMtfzPYqBXMOUcK2PcG2plQl1ZCHmQCNICUNwU8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754643085; c=relaxed/simple; bh=6br5nTgA5maFWMZ6HbJMM8iKHL3+b9FbrzZMETx9ycY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=JBG/jNYkg1AMMNzCAzwIjCpzRCyrS2BOduHqJSOczVlFfw9z0vTRNQlvoaBFm7U2me+UxLSNp75q6VdSE7ffCHSsZvHwBpAQjzAEmZWLjFcIw4ep6pDHcorwdT5q+Y7unpq3Q1z+FNRmRCSQEqiqs9LuXsLCOlX9vn0KuCD8Is8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=KQR5OC6M; arc=none smtp.client-ip=209.85.167.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KQR5OC6M" Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-55b847a061dso3271590e87.1; Fri, 08 Aug 2025 01:51:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754643073; x=1755247873; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=FbRzQcoI5p8Cuon7i7slUApzPry4R+j3QLxr6UFlktk=; b=KQR5OC6Md9gAyB0XVtRs2Pe/H6qxAOdjicnndzgIc6wNMvf4NC6Ec+msAPVHIwB+GP UWgOFKPVEGI1Z/vMqVwjZMsNFua92kOHmbNJCx5DBhTn1ev1IOzRZFyhTdpYLCLLnpbX P5rZOArTrOxa6nbcuREwAo80TSmtzrmtuBvZYPtjKKlTIR1PH9008NaR/Lx7eoT6Okq0 GNtaiGgSZO0G10r9QLbBspF1XDW6wrbO+esBe8KdFlmu10ATmYmeoXRPsLyzj9WZvfKV U4/aDg6cR2s6y8nc3H5/dV0cqcBKXRHJhuMj2hUYzM6AiHcjGVKOJ+dNrKmb/1o2l54m 7wOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754643073; x=1755247873; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=FbRzQcoI5p8Cuon7i7slUApzPry4R+j3QLxr6UFlktk=; b=pXOVj+eSHioQM3FREfnQtkFO7852E1/Km0xpsx6ZK183aO+BOKPyu/VXzP2B+vxa8U UO1tXc22eK05a2jMYKrk/JeXxi6yZmWBTVDvNzvOpVk283Kumb/JzT9n3x4gv+xjt0nX MZjz+j44uXO1tcW2ATGNIuOP0MU2OlQFa26l9w8GMrtRNaKnertGPTYGgqQcwY8WHycz L/Hof/mIPIx5L1UuzNXxokfd0fu6rU8WAoTRoZAjBdvCInqg2xfUzrPHK8fK+c2s3WWN lSV7O/2lYYKy8wyq8D1dAKlalDLxc1e+RhYFmS8o14tnPaXMiHGwoqjZhiRgO/01nQ5Z rKYg== X-Forwarded-Encrypted: i=1; AJvYcCUZY+MsiD6X/1Wlm5ZkOXLbLofAKzesZ+s8C3I0kFKaHwhFKUgDGpCDdJEMmLYKMkm7BdbgWCn2JF3Z@vger.kernel.org, AJvYcCVNIypwG5sFqIHhvXUcEU8etDaB2XDzv/37dxOB6rATHiCzkw+WB0BfKvrboaWiRywDJ5XMaTWWZdSJC8qc@vger.kernel.org, AJvYcCXK20RCitkNxujkRBK/QQrlDGjxqma2Z/vHC71USneIK+EEsFD1ohaGG06jh3hda11gpkPkWRzwHh8t@vger.kernel.org X-Gm-Message-State: AOJu0YzYkBK0VGsFi9QsTTCtYF/pGJrwYef4Bw1lNJMoYNf19yubf/zL U00iGMLvAdRmaW2S33jjkxi3LWv+t3nY/zVvCX2jZNntu/g9FKbPD7/S X-Gm-Gg: ASbGncvKWRRCw9qSp5aaMlfIVb5yf5qbXL+GzBobumI85+7ukkuCVDhh4Yzv4TFV2y6 rDNRirQLihTnFhVB8+MCOFZ3izhXMKRpD3ci/3Ovwf1vScjN5L0DrrS/7jwxQIaMGTdz8auYGil jWiJVWPK94x+xrN2wv12VqVtXOEWqJJbyOdvWffIGvLJGI1xKCquLWHb1641GgUR/K+RimwCoQ9 Gs4pG/s/Fg9eHosIdhN1Z8ekaw93LZFKTIhUwBx5dpq6krhTn+CXT/mxtXQwKRjvAmEe5Zhyc/d idVy5MK51x1RIFX1+FwIAVFjXBWAjelLL5hsGSs/EWwnePSZc9kjV5kfg59YwLtpa5Y56CmX9QH uontSrA5TGTwpzd2mt4p56J5qNXHt X-Google-Smtp-Source: AGHT+IFWULd8THCsKz7LJ3aVH1OOK0FIBZt7VE5cErmpwWhz3fJIpx/Rb8CFrN3cmnE0YT9EAMkH3w== X-Received: by 2002:a05:6512:239c:b0:556:fb24:6f85 with SMTP id 2adb3069b0e04-55cb61e220cmr2130734e87.22.1754643073163; Fri, 08 Aug 2025 01:51:13 -0700 (PDT) Received: from mva-rohm ([2a10:a5c0:800d:dd00:8fdf:935a:2c85:d703]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-55b88ca678dsm2900335e87.122.2025.08.08.01.51.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Aug 2025 01:51:12 -0700 (PDT) Date: Fri, 8 Aug 2025 11:51:07 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , David Lechner , Nuno =?iso-8859-1?Q?S=E1?= , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matti Vaittinen , Liam Girdwood , Mark Brown , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 01/10] iio: adc: ad7476: Simplify chip type detection Message-ID: <65f5002c66e5cb25567bc5220fa4d5c717b6892e.1754641960.git.mazziesaccount@gmail.com> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="bfui9F+F+8cMYDJr" Content-Disposition: inline In-Reply-To: --bfui9F+F+8cMYDJr Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The ad7476 driver uses a table of structures for defining the IC variant specific data. Table is indexed using enum values, which are picked by SPI ID. Having the table and an enum adds extra complexity and may encourage adding IC specific quircks in the code, instead of centralizing the IC differences in one place, the chip-info. Simplify this by dropping the table and using individual structures for the IC specific data, and storing the IC specific structure's address directly in the SPI ID data. Finally, switch to the spi_get_device_match_data() and add a check for the return value. Signed-off-by: Matti Vaittinen Reviewed-by: Nuno S=C3=A1 Reviewed-by: Andy Shevchenko --- Revision history: v1 =3D> - No changes This patch was originally sent as an RFC in 2 patch series: https://lore.kernel.org/all/cover.1754041258.git.mazziesaccount@gmail.com/ Changes from the RFC =3D> v1: - Use spi_get_device_match_data() - Slightly reword commit message --- drivers/iio/adc/ad7476.c | 296 +++++++++++++++++++-------------------- 1 file changed, 146 insertions(+), 150 deletions(-) diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c index aea734aa06bd..9869526c1524 100644 --- a/drivers/iio/adc/ad7476.c +++ b/drivers/iio/adc/ad7476.c @@ -52,29 +52,6 @@ struct ad7476_state { unsigned char data[ALIGN(2, sizeof(s64)) + sizeof(s64)] __aligned(IIO_DMA= _MINALIGN); }; =20 -enum ad7476_supported_device_ids { - ID_AD7091, - ID_AD7091R, - ID_AD7273, - ID_AD7274, - ID_AD7276, - ID_AD7277, - ID_AD7278, - ID_AD7466, - ID_AD7467, - ID_AD7468, - ID_AD7475, - ID_AD7495, - ID_AD7940, - ID_ADC081S, - ID_ADC101S, - ID_ADC121S, - ID_ADS7866, - ID_ADS7867, - ID_ADS7868, - ID_LTC2314_14, -}; - static void ad7091_convst(struct ad7476_state *st) { if (!st->convst_gpio) @@ -190,102 +167,119 @@ static int ad7476_read_raw(struct iio_dev *indio_de= v, #define ADS786X_CHAN(bits) _AD7476_CHAN((bits), 12 - (bits), \ BIT(IIO_CHAN_INFO_RAW)) =20 -static const struct ad7476_chip_info ad7476_chip_info_tbl[] =3D { - [ID_AD7091] =3D { - .channel[0] =3D AD7091R_CHAN(12), - .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), - .convst_channel[0] =3D AD7091R_CONVST_CHAN(12), - .convst_channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), - .reset =3D ad7091_reset, - }, - [ID_AD7091R] =3D { - .channel[0] =3D AD7091R_CHAN(12), - .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), - .convst_channel[0] =3D AD7091R_CONVST_CHAN(12), - .convst_channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), - .int_vref_uv =3D 2500000, - .has_vref =3D true, - .reset =3D ad7091_reset, - }, - [ID_AD7273] =3D { - .channel[0] =3D AD7940_CHAN(10), - .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), - .has_vref =3D true, - }, - [ID_AD7274] =3D { - .channel[0] =3D AD7940_CHAN(12), - .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), - .has_vref =3D true, - }, - [ID_AD7276] =3D { - .channel[0] =3D AD7940_CHAN(12), - .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), - }, - [ID_AD7277] =3D { - .channel[0] =3D AD7940_CHAN(10), - .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), - }, - [ID_AD7278] =3D { - .channel[0] =3D AD7940_CHAN(8), - .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), - }, - [ID_AD7466] =3D { - .channel[0] =3D AD7476_CHAN(12), - .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), - }, - [ID_AD7467] =3D { - .channel[0] =3D AD7476_CHAN(10), - .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), - }, - [ID_AD7468] =3D { - .channel[0] =3D AD7476_CHAN(8), - .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), - }, - [ID_AD7475] =3D { - .channel[0] =3D AD7476_CHAN(12), - .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), - .has_vref =3D true, - .has_vdrive =3D true, - }, - [ID_AD7495] =3D { - .channel[0] =3D AD7476_CHAN(12), - .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), - .int_vref_uv =3D 2500000, - .has_vdrive =3D true, - }, - [ID_AD7940] =3D { - .channel[0] =3D AD7940_CHAN(14), - .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), - }, - [ID_ADC081S] =3D { - .channel[0] =3D ADC081S_CHAN(8), - .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), - }, - [ID_ADC101S] =3D { - .channel[0] =3D ADC081S_CHAN(10), - .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), - }, - [ID_ADC121S] =3D { - .channel[0] =3D ADC081S_CHAN(12), - .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), - }, - [ID_ADS7866] =3D { - .channel[0] =3D ADS786X_CHAN(12), - .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), - }, - [ID_ADS7867] =3D { - .channel[0] =3D ADS786X_CHAN(10), - .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), - }, - [ID_ADS7868] =3D { - .channel[0] =3D ADS786X_CHAN(8), - .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), - }, - [ID_LTC2314_14] =3D { - .channel[0] =3D AD7940_CHAN(14), - .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), - .has_vref =3D true, - }, +static const struct ad7476_chip_info ad7091_chip_info =3D { + .channel[0] =3D AD7091R_CHAN(12), + .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), + .convst_channel[0] =3D AD7091R_CONVST_CHAN(12), + .convst_channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), + .reset =3D ad7091_reset, +}; + +static const struct ad7476_chip_info ad7091r_chip_info =3D { + .channel[0] =3D AD7091R_CHAN(12), + .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), + .convst_channel[0] =3D AD7091R_CONVST_CHAN(12), + .convst_channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), + .int_vref_uv =3D 2500000, + .has_vref =3D true, + .reset =3D ad7091_reset, +}; + +static const struct ad7476_chip_info ad7273_chip_info =3D { + .channel[0] =3D AD7940_CHAN(10), + .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), + .has_vref =3D true, +}; + +static const struct ad7476_chip_info ad7274_chip_info =3D { + .channel[0] =3D AD7940_CHAN(12), + .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), + .has_vref =3D true, +}; + +static const struct ad7476_chip_info ad7276_chip_info =3D { + .channel[0] =3D AD7940_CHAN(12), + .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), +}; + +static const struct ad7476_chip_info ad7277_chip_info =3D { + .channel[0] =3D AD7940_CHAN(10), + .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), +}; + +static const struct ad7476_chip_info ad7278_chip_info =3D { + .channel[0] =3D AD7940_CHAN(8), + .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), +}; + +static const struct ad7476_chip_info ad7466_chip_info =3D { + .channel[0] =3D AD7476_CHAN(12), + .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), +}; + +static const struct ad7476_chip_info ad7467_chip_info =3D { + .channel[0] =3D AD7476_CHAN(10), + .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), +}; + +static const struct ad7476_chip_info ad7468_chip_info =3D { + .channel[0] =3D AD7476_CHAN(8), + .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), +}; + +static const struct ad7476_chip_info ad7475_chip_info =3D { + .channel[0] =3D AD7476_CHAN(12), + .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), + .has_vref =3D true, + .has_vdrive =3D true, +}; + +static const struct ad7476_chip_info ad7495_chip_info =3D { + .channel[0] =3D AD7476_CHAN(12), + .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), + .int_vref_uv =3D 2500000, + .has_vdrive =3D true, +}; + +static const struct ad7476_chip_info ad7940_chip_info =3D { + .channel[0] =3D AD7940_CHAN(14), + .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), +}; + +static const struct ad7476_chip_info adc081s_chip_info =3D { + .channel[0] =3D ADC081S_CHAN(8), + .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), +}; + +static const struct ad7476_chip_info adc101s_chip_info =3D { + .channel[0] =3D ADC081S_CHAN(10), + .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), +}; + +static const struct ad7476_chip_info adc121s_chip_info =3D { + .channel[0] =3D ADC081S_CHAN(12), + .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), +}; + +static const struct ad7476_chip_info ads7866_chip_info =3D { + .channel[0] =3D ADS786X_CHAN(12), + .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), +}; + +static const struct ad7476_chip_info ads7867_chip_info =3D { + .channel[0] =3D ADS786X_CHAN(10), + .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), +}; + +static const struct ad7476_chip_info ads7868_chip_info =3D { + .channel[0] =3D ADS786X_CHAN(8), + .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), +}; + +static const struct ad7476_chip_info ltc2314_14_chip_info =3D { + .channel[0] =3D AD7940_CHAN(14), + .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), + .has_vref =3D true, }; =20 static const struct iio_info ad7476_info =3D { @@ -311,8 +305,10 @@ static int ad7476_probe(struct spi_device *spi) return -ENOMEM; =20 st =3D iio_priv(indio_dev); - st->chip_info =3D - &ad7476_chip_info_tbl[spi_get_device_id(spi)->driver_data]; + + st->chip_info =3D spi_get_device_match_data(spi); + if (!st->chip_info) + return -ENODEV; =20 reg =3D devm_regulator_get(&spi->dev, "vcc"); if (IS_ERR(reg)) @@ -408,41 +404,41 @@ static int ad7476_probe(struct spi_device *spi) } =20 static const struct spi_device_id ad7476_id[] =3D { - { "ad7091", ID_AD7091 }, - { "ad7091r", ID_AD7091R }, - { "ad7273", ID_AD7273 }, - { "ad7274", ID_AD7274 }, - { "ad7276", ID_AD7276}, - { "ad7277", ID_AD7277 }, - { "ad7278", ID_AD7278 }, - { "ad7466", ID_AD7466 }, - { "ad7467", ID_AD7467 }, - { "ad7468", ID_AD7468 }, - { "ad7475", ID_AD7475 }, - { "ad7476", ID_AD7466 }, - { "ad7476a", ID_AD7466 }, - { "ad7477", ID_AD7467 }, - { "ad7477a", ID_AD7467 }, - { "ad7478", ID_AD7468 }, - { "ad7478a", ID_AD7468 }, - { "ad7495", ID_AD7495 }, - { "ad7910", ID_AD7467 }, - { "ad7920", ID_AD7466 }, - { "ad7940", ID_AD7940 }, - { "adc081s", ID_ADC081S }, - { "adc101s", ID_ADC101S }, - { "adc121s", ID_ADC121S }, - { "ads7866", ID_ADS7866 }, - { "ads7867", ID_ADS7867 }, - { "ads7868", ID_ADS7868 }, + { "ad7091", (kernel_ulong_t)&ad7091_chip_info }, + { "ad7091r", (kernel_ulong_t)&ad7091r_chip_info }, + { "ad7273", (kernel_ulong_t)&ad7273_chip_info }, + { "ad7274", (kernel_ulong_t)&ad7274_chip_info }, + { "ad7276", (kernel_ulong_t)&ad7276_chip_info }, + { "ad7277", (kernel_ulong_t)&ad7277_chip_info }, + { "ad7278", (kernel_ulong_t)&ad7278_chip_info }, + { "ad7466", (kernel_ulong_t)&ad7466_chip_info }, + { "ad7467", (kernel_ulong_t)&ad7467_chip_info }, + { "ad7468", (kernel_ulong_t)&ad7468_chip_info }, + { "ad7475", (kernel_ulong_t)&ad7475_chip_info }, + { "ad7476", (kernel_ulong_t)&ad7466_chip_info }, + { "ad7476a", (kernel_ulong_t)&ad7466_chip_info }, + { "ad7477", (kernel_ulong_t)&ad7467_chip_info }, + { "ad7477a", (kernel_ulong_t)&ad7467_chip_info }, + { "ad7478", (kernel_ulong_t)&ad7468_chip_info }, + { "ad7478a", (kernel_ulong_t)&ad7468_chip_info }, + { "ad7495", (kernel_ulong_t)&ad7495_chip_info }, + { "ad7910", (kernel_ulong_t)&ad7467_chip_info }, + { "ad7920", (kernel_ulong_t)&ad7466_chip_info }, + { "ad7940", (kernel_ulong_t)&ad7940_chip_info }, + { "adc081s", (kernel_ulong_t)&adc081s_chip_info }, + { "adc101s", (kernel_ulong_t)&adc101s_chip_info }, + { "adc121s", (kernel_ulong_t)&adc121s_chip_info }, + { "ads7866", (kernel_ulong_t)&ads7866_chip_info }, + { "ads7867", (kernel_ulong_t)&ads7867_chip_info }, + { "ads7868", (kernel_ulong_t)&ads7868_chip_info }, /* * The ROHM BU79100G is identical to the TI's ADS7866 from the software * point of view. The binding document mandates the ADS7866 to be * marked as a fallback for the BU79100G, but we still need the SPI ID * here to make the module loading work. */ - { "bu79100g", ID_ADS7866 }, - { "ltc2314-14", ID_LTC2314_14 }, + { "bu79100g", (kernel_ulong_t)&ads7866_chip_info }, + { "ltc2314-14", (kernel_ulong_t)<c2314_14_chip_info }, { } }; MODULE_DEVICE_TABLE(spi, ad7476_id); --=20 2.50.1 --bfui9F+F+8cMYDJr Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmiVunsACgkQeFA3/03a ocWAHQf/UPYCz4EIKH6Z/bBSSUaLOpzX3I57yIuDDfT1W7SqyzOWci34ksdlbB2k /Silv6Du17kY1eWzijIlGZoQRRbNe72ZdZsh04CdGdIExoExYl2di72J5Ictk7r5 LiHWpOuWWkjkV9dBGX2Vp3KKvzbzpB7Kbj3f54ceaXkgnn6I7MfIY/fyMGml723A 0G994cHQMKBD4HvC75x3UHfKX2GtCgQGezZaOqQCkIVXbO9KE4t7O8XHlNuqUR0E cKZuQ/BaRIw5KQXJItEer0T1v3BqHW8uFBOCcKlwLW5uUm4RhUR3WX32pGxAovl8 K/kDqRhCmk3UQWR78FPdFhSHCTJPBQ== =zDPB -----END PGP SIGNATURE----- --bfui9F+F+8cMYDJr-- From nobody Sun Dec 14 01:38:56 2025 Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.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 B600F26D4D5; Fri, 8 Aug 2025 08:51:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754643094; cv=none; b=g8O52fRbToDbFSkK6QBJRRxbdVI54Rk9aMuD//cEUsuCsFcvMAkcAH+8sGBoLQhgQsd1Ppl+hYzcpYkCTgT7NCz3FMfqjZWOJVvklZwJhkS7mgoSnf7llnR3smo7lkmRKH/u3l6gnlf/1NTM4qSs8nMaOxxnUj+ue3EiOf0uYwg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754643094; c=relaxed/simple; bh=i3Gj/eGdxovc1S1YRB7Ee0F2MtWAFEDFX2x1Bz9i86c=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Urhevt61aS8P0HJCfCv0Q2MV34SEcyiuTxOiWXCdFDo+zqSabJ09iXsL3gP6HXdQIJsVTSNGIbevaMRK5OjJrymLgwZfb1dHWvUxfLixW/mxUmFVKDmJWW2b3wN4gYWGZvpNpHKOSQp5j00xe0khVfRQCfbAZZT0XPFcLxj+ruA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ex309Po0; arc=none smtp.client-ip=209.85.167.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ex309Po0" Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-55b88369530so2121658e87.0; Fri, 08 Aug 2025 01:51:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754643090; x=1755247890; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=wG7aBfRHnHo0r7lCWYEcuTsWYHXTQH7vU37MjVO2mqY=; b=ex309Po0LhpHw76WA3Hhfj6v22yFKjKZ+lkG9zo+7Ben1fGp8nnFvkUBZJpw1dBXeE kYJE/UCKPsURJkpYGKaURH1g6OWu50I6qGecl4AnKI+sA58F5c/8vrBo2bUjQPJzA6r2 P4+AqkyeNTezjqvgVQXrmFtdZKD2NJMMKFlx8NrkURKYPq9is1AeeMJ1RD+45/qQNX48 W+WOx9v/1ljc/6zegpp8Tg0b/Aaj+PVmraQcHJA+GliD7kyjWhUyqwSAtAciXtitJBCh ldrpkTbvpg5JtMhRQFQSbM/kqy5Sy81AMbBe7i5ZCDT5SZuSZsROA6ADkroQaeS3iPyx A2Lw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754643090; x=1755247890; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=wG7aBfRHnHo0r7lCWYEcuTsWYHXTQH7vU37MjVO2mqY=; b=QzUFOCFFxyIZZQFrxlKBLSGqK3l/xs4AuLDQVTTMQdcFJzL04ylj7JV63kPOEiTRWW gJNNk7MkcjS+PBy45JTIxJV30wV71VAG5vgX67BAsP6HUlY5kRrQFLgRPYTD8ybNkGMt bHOmWo0kIzssGxnaYeu0mYZ4u6yrZ3KENghe+ZBLj+henieL+qHCxlNJxrLmdb1hpNQK joVUnqzsPaB1szNyuEvQM4DQ8PKazVZUPWNub5D4LFdqG5/rrZMczSBqMQKNiL9kX20S O8HsihsjhJDTBR4ObEQlkg4zFmfa2qJNOZ9EWsDIEblaNxPTn9o64cf/c3DrfbeKFHeZ oBzQ== X-Forwarded-Encrypted: i=1; AJvYcCU2LnPqqumPjDFzxenpIiBcKUy+BigMPoJdZa3By2kL7Hw79jSHVq9/Q9DvZ9dKiqoTzhTUgaszsyYxX/R5@vger.kernel.org, AJvYcCVVeX+Z+4y4kW53E01MVwCAhJHhyBvH0glW0bJJAvK0j6SGkwoYvthgJneFdGJWBUpDE8CSD1yrNVAH@vger.kernel.org, AJvYcCWPvKWMS5ayvI6mM977nOL8FfSopbhRbDCJgCx1Vqxcyt8Gq7FGYGv3QyNaFW9rwKsuwK1uTKhUlHLA@vger.kernel.org X-Gm-Message-State: AOJu0Yzb2A4uIN3q5MXdfg2GQZsO7zAlek+T7OpJoH6NEXefJmGnHh1o BbY7FkyPl0rc4Pa4RoHm8cwBcdGfsE1Osx23EmWm6SLYbxSFDnDqdYo1 X-Gm-Gg: ASbGncsijmIqgIkkPsxd+QTHsxIwlhaVWzqW+PzY4/58BNgUQizASbKx9quGo1YiEqz rmc67amCe9IwKkFnS5t47ASVvyFjXRmWwhv19NzTXbzzvGh7ASKH8xJNnuOcRnvs9YihGa1l/xp S+b9XkgFcVz1voJBmcksmLqPfjbRXF82N4ApnTSPBgj2sC+l1HVlyaNmNQb/Z7sWvfxmVPIaCV1 928JdaLJFEIOzZNYvVgyWcvNIHcIL11H0N8R7kf9/bANeLbZADtbWrV0Vtz7D6UKr0t8jxo0S8s 0pt6enBnZbzELK9q2IBmqORALECrtARRmSkcwQNrnuYeCPE5cTrtbTEQNuYFLOFU0Jf4W+BlTLe iHt8lnM2/NMGCmdeismcB2NSf8XqX X-Google-Smtp-Source: AGHT+IFktDMP92fd3xwj6HpLG4KUTK4DqzevdxSYJvT0Hg1irkXLwGs5vFiLx0OlhQjtxCrKPuvhug== X-Received: by 2002:a05:6512:3e26:b0:553:23f9:bb37 with SMTP id 2adb3069b0e04-55cc0149c19mr457657e87.40.1754643089573; Fri, 08 Aug 2025 01:51:29 -0700 (PDT) Received: from mva-rohm ([2a10:a5c0:800d:dd00:8fdf:935a:2c85:d703]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-55b88c9919bsm3031969e87.89.2025.08.08.01.51.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Aug 2025 01:51:28 -0700 (PDT) Date: Fri, 8 Aug 2025 11:51:25 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , David Lechner , Nuno =?iso-8859-1?Q?S=E1?= , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matti Vaittinen , Liam Girdwood , Mark Brown , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 02/10] iio: adc: ad7476: Simplify scale handling Message-ID: <593907619b726f22a383ac527941241a34bfafd7.1754641960.git.mazziesaccount@gmail.com> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="MWnzZwHDcaylGcU2" Content-Disposition: inline In-Reply-To: --MWnzZwHDcaylGcU2 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The ad7476 driver supports variants with different amount of supply regulators. On some variants there is only VCC, which is used as a reference voltage. Others have separate VREF regulator, and some rely on internal VREF. Some have both internal VREF and option to connect external one. The ad7476 driver reads the regulator voltage only when the user asks to get the scale. This means the driver needs to do some dancing while picking the correct reference regulator (or internal reference), and store it for the later use. According to the discussion [1] variable voltage references are rare, making it hard to justify the added complexity for supporting those. Drop the support for the variable voltage references and simplify things by using the managed regulator get and enable interfaces. Link: https://lore.kernel.org/linux-iio/20250331122247.05c6b09d@jic23-huawe= i/ #1 Signed-off-by: Matti Vaittinen Reviewed-by: Nuno S=C3=A1 Reviewed-by: Andy Shevchenko --- Revision history: v2 =3D> : - No changes v1 =3D> v2: - use link-tag This patch was originally sent as an RFC in 2 patch series: https://lore.kernel.org/all/cover.1754041258.git.mazziesaccount@gmail.com/ Changes from the RFC: - Fix the faulty conversion from uV to mV as pointed out by David. --- drivers/iio/adc/ad7476.c | 84 ++++++++++------------------------------ 1 file changed, 21 insertions(+), 63 deletions(-) diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c index 9869526c1524..f117aafd8fad 100644 --- a/drivers/iio/adc/ad7476.c +++ b/drivers/iio/adc/ad7476.c @@ -39,10 +39,10 @@ struct ad7476_chip_info { struct ad7476_state { struct spi_device *spi; const struct ad7476_chip_info *chip_info; - struct regulator *ref_reg; struct gpio_desc *convst_gpio; struct spi_transfer xfer; struct spi_message msg; + int scale_mv; /* * DMA (thus cache coherency maintenance) may require the * transfer buffers to live in their own cache lines. @@ -111,7 +111,6 @@ static int ad7476_read_raw(struct iio_dev *indio_dev, { int ret; struct ad7476_state *st =3D iio_priv(indio_dev); - int scale_uv; =20 switch (m) { case IIO_CHAN_INFO_RAW: @@ -126,14 +125,7 @@ static int ad7476_read_raw(struct iio_dev *indio_dev, GENMASK(st->chip_info->channel[0].scan_type.realbits - 1, 0); return IIO_VAL_INT; case IIO_CHAN_INFO_SCALE: - if (st->ref_reg) { - scale_uv =3D regulator_get_voltage(st->ref_reg); - if (scale_uv < 0) - return scale_uv; - } else { - scale_uv =3D st->chip_info->int_vref_uv; - } - *val =3D scale_uv / 1000; + *val =3D st->scale_mv; *val2 =3D chan->scan_type.realbits; return IIO_VAL_FRACTIONAL_LOG2; } @@ -286,18 +278,10 @@ static const struct iio_info ad7476_info =3D { .read_raw =3D &ad7476_read_raw, }; =20 -static void ad7476_reg_disable(void *data) -{ - struct regulator *reg =3D data; - - regulator_disable(reg); -} - static int ad7476_probe(struct spi_device *spi) { struct ad7476_state *st; struct iio_dev *indio_dev; - struct regulator *reg; int ret; =20 indio_dev =3D devm_iio_device_alloc(&spi->dev, sizeof(*st)); @@ -310,58 +294,32 @@ static int ad7476_probe(struct spi_device *spi) if (!st->chip_info) return -ENODEV; =20 - reg =3D devm_regulator_get(&spi->dev, "vcc"); - if (IS_ERR(reg)) - return PTR_ERR(reg); - - ret =3D regulator_enable(reg); - if (ret) - return ret; - - ret =3D devm_add_action_or_reset(&spi->dev, ad7476_reg_disable, reg); - if (ret) - return ret; - - /* Either vcc or vref (below) as appropriate */ - if (!st->chip_info->int_vref_uv) - st->ref_reg =3D reg; + /* Use VCC for reference voltage if vref / internal vref aren't used */ + if (!st->chip_info->int_vref_uv && !st->chip_info->has_vref) { + ret =3D devm_regulator_get_enable_read_voltage(&spi->dev, "vcc"); + if (ret < 0) + return ret; + st->scale_mv =3D ret / 1000; + } else { + ret =3D devm_regulator_get_enable(&spi->dev, "vcc"); + if (ret < 0) + return ret; + } =20 if (st->chip_info->has_vref) { - - /* If a device has an internal reference vref is optional */ - if (st->chip_info->int_vref_uv) { - reg =3D devm_regulator_get_optional(&spi->dev, "vref"); - if (IS_ERR(reg) && (PTR_ERR(reg) !=3D -ENODEV)) - return PTR_ERR(reg); - } else { - reg =3D devm_regulator_get(&spi->dev, "vref"); - if (IS_ERR(reg)) - return PTR_ERR(reg); - } - - if (!IS_ERR(reg)) { - ret =3D regulator_enable(reg); - if (ret) + ret =3D devm_regulator_get_enable_read_voltage(&spi->dev, "vref"); + if (ret < 0) { + /* Vref is optional if a device has an internal reference */ + if (!st->chip_info->int_vref_uv || ret !=3D -ENODEV) return ret; - - ret =3D devm_add_action_or_reset(&spi->dev, - ad7476_reg_disable, - reg); - if (ret) - return ret; - st->ref_reg =3D reg; } else { - /* - * Can only get here if device supports both internal - * and external reference, but the regulator connected - * to the external reference is not connected. - * Set the reference regulator pointer to NULL to - * indicate this. - */ - st->ref_reg =3D NULL; + st->scale_mv =3D ret / 1000; } } =20 + if (!st->scale_mv) + st->scale_mv =3D st->chip_info->int_vref_uv / 1000; + if (st->chip_info->has_vdrive) { ret =3D devm_regulator_get_enable(&spi->dev, "vdrive"); if (ret) --=20 2.50.1 --MWnzZwHDcaylGcU2 Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmiVuo0ACgkQeFA3/03a ocXT4Af/WW0NjnvKnc+auIxAj9ZYud5yhDBfhjEyIgtfb0C3y5vuh4QnHR2E4KEQ oqy/J/Uw2JZr7iNxy7mTg4PWjb8dbsyg/sZXbPKJbi2HnCoTtRYoElMhSYl5wMAH MOUk/rGsuOgib6liHqClHlgXNrVR73NmYRWPfJwDh7BQMp4G4wtGvt9+44YdPnJR 0FB/WZBkKTbt9eBvOAyTcRX4CcHl1m4s51+PC1QT3Dww0eY0yn7KddBdH5hBMVLd FiXz5uZdJJeXi/U9aY+X4lMLwVashpyA4ENDJzTiFmUvBM8b5mEPVKHvIPKNzBjp HSeMTUKQ8l8O9Ems+sl1gSNoJeWT1Q== =vM78 -----END PGP SIGNATURE----- --MWnzZwHDcaylGcU2-- From nobody Sun Dec 14 01:38:56 2025 Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.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 CA91D268C73; Fri, 8 Aug 2025 08:51:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754643110; cv=none; b=Z/F6/4DwBRbMX3rkzE7pO57UsnoMAbCron+JQ6TkpmdCrhVszE7Lfn2rFnIU7TeFelW2EtoqrSleLhm6rTo5E8gsViI022UBxuTPMVBHtrRAA/1CjOAtIqlMwi482wWdK4hJbGXR6oHv7lgIM/HCIA3C54FgguzIP5JFCKmYHgQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754643110; c=relaxed/simple; bh=0m0hKxLzTdzkDYBIBlYlTeudZELSlrRSc04taSSYqEM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jfF0WyK55atrEqKXbiOhk2/awIyo6snIeKwAyNhAaAUntpwRTkoIwS+I+n8VZGQ08pmcSkMkXtCXyaZZKE0kOBAoyInvNM4xbHS6lJCLDhwxUWQbGMLR8Kd2TiZT9nmS4FxJnL9puTwLYTswapAwIS0nROuT3dpFznT97eB6kkA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=kmAVN+Wt; arc=none smtp.client-ip=209.85.167.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kmAVN+Wt" Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-5561ab55c4dso1943258e87.2; Fri, 08 Aug 2025 01:51:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754643105; x=1755247905; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Bc2SZUvYGAJAUUUWD4PqsS9pm2C4LFST32f4fyynuTA=; b=kmAVN+WttRixgCZZvWB0QVaj4XhmmrhU00HP3ifwNHafZmPEGr3Dbxf6VI+f9STSBC 97npm4JIf64Z8nDq3kKszqfll4sFhloTGbFC3SrhwC0qXx75mYw4AftZTcBlU8pQp25H QnfTVEfEkzHl1+HQfEgf3g37Ofdt532X6Qfhz8/J7YCCqEyXsdhr5UsxOWK1QmWi+iTz JwGXv/QUAZCuobH1Lkx1MJ5oBHmJwCObMpO7WbgQeCI5TIApU7cDGA9KTRndotUZfKMG T8WqbrXlDsQ3zl26x5mB+sYyi+z83AMoZkkz8lh2kOUUqhDgXEdiD4hU5r5rTA0lshFa VvTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754643105; x=1755247905; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Bc2SZUvYGAJAUUUWD4PqsS9pm2C4LFST32f4fyynuTA=; b=H8jWleaLcbaMzblVJbiCuzAS0oHjLZuylcjTiDfZsMpk45rIlf4sP5RLtmQAYsRKiU seVjEQBs3UySxdZ7EXD0TC2kfOhGxyJ1eSVVLa28sVwy3Q3KwMd1SkPVihtSfX5X4v7L k6PPQ/9VqncjP0giFZpzy2VMoOJDJaBpPzkQ2pjCnMpbenW0CBDRB3iXuCJsZ9Q1xFb6 F7Bytgl84PX+TPONUd08XPOiVqUZegLTc+Ou2Jo0OCwyHGuPio6G85Irz20HX3ISDrqm GOtzkHHD973zdC+2m1nvMniwfJN0TyNyeW932YUEVxsIQbisQ+CJKcc4fgYBm3jBtCdB rtoQ== X-Forwarded-Encrypted: i=1; AJvYcCWsznac/Rrah9mZlK4Mgk30WUowp++ykmvsdTdpl+upH2kdpP+xLnPk1WOzOhrfzGSenkrSIkz0xWu8+xJq@vger.kernel.org, AJvYcCX2rkGWTwDosPb1/jciTCmYRU/So2/mcA6U26tBxfvOtW1SJ2BfDe7KloOraVnzkMXAAvj8KjEAZ+kQ@vger.kernel.org, AJvYcCXuPuz7n6W5esYxZAV/xfviLSQebDygi07/uksqySCqdFLRdz2F7xZsgrqVcY4rhuO8egCKO2eKlL6A@vger.kernel.org X-Gm-Message-State: AOJu0YyNLvZvw1+PI4ouO4wBGY5KW0nYtF6TPVS/CpljrSjuUEg48mfF Khok58VIj7koZMyFOZzUHXqgQ7SgODGhLPCGir0nY2YIQIoaHGEv1YGt X-Gm-Gg: ASbGncupnFNAptfayJ+4D7H7jD+0FdeTNSA/UOq1V73yz7mvcyNjcNhnV+F7namO43p Tz6qvyjrCD83E5WDxgPscaznaJUym589deiGcrgcohr2a5SR3Zr/3JS763ieJjqNzCb3o1V8o6P cvTZDlO5LzJOLFHwkOTyuY3MDI3n3AM+pIfMpfO6PVhEpA6YtsQYPhk87EE6Wf9edAY4UhbQ5u0 R4VMv05ltfZByOa2tyHADfO6UPBhp2FkQd9fwFLJT4y2itA39D1ZYlouA2sTk2pHz0cHVkPTnQE h2SHIGoqLnLzjirsyXZNqfV0CFOWCDEhBONQwv7clIzizSO5fFfHlRQjIPkfJG+wuFopq7Ill9D vEJ9zh4+Mc5252tXPaJULaqg+6ecE X-Google-Smtp-Source: AGHT+IFqzcRq4VVkEu+exCO4BNgSeLHEU9yVzn85s2o4vFUGFMe6G0VEL7yMxmECfN6o1ywNkq/WSw== X-Received: by 2002:a05:6512:b82:b0:553:37da:2bad with SMTP id 2adb3069b0e04-55cc0127ed4mr500626e87.38.1754643104761; Fri, 08 Aug 2025 01:51:44 -0700 (PDT) Received: from mva-rohm ([2a10:a5c0:800d:dd00:8fdf:935a:2c85:d703]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-332388fc7b8sm28453541fa.62.2025.08.08.01.51.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Aug 2025 01:51:43 -0700 (PDT) Date: Fri, 8 Aug 2025 11:51:40 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , David Lechner , Nuno =?iso-8859-1?Q?S=E1?= , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matti Vaittinen , Liam Girdwood , Mark Brown , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 03/10] iio: adc: ad7476: Use mV for internal reference Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="cVstOuumvj/F2loe" Content-Disposition: inline In-Reply-To: --cVstOuumvj/F2loe Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The ad7476 supports some ICs with an internal reference voltage. For those ICs the reference voltage has been hard-coded as micro volts, but the value which is later used in code needs to be milli volts. This results the need to divide hard coded voltage by 1000 before using it. Simplify code by changing the hard-coded voltage to millivolts and by dropping the division. Signed-off-by: Matti Vaittinen Reviewed-by: Nuno S=C3=A1 Reviewed-by: Andy Shevchenko --- Revision history: v1 =3D> : - No changes --- drivers/iio/adc/ad7476.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c index f117aafd8fad..7b6d36999afc 100644 --- a/drivers/iio/adc/ad7476.c +++ b/drivers/iio/adc/ad7476.c @@ -27,7 +27,7 @@ struct ad7476_state; =20 struct ad7476_chip_info { - unsigned int int_vref_uv; + unsigned int int_vref_mv; struct iio_chan_spec channel[2]; /* channels used when convst gpio is defined */ struct iio_chan_spec convst_channel[2]; @@ -172,7 +172,7 @@ static const struct ad7476_chip_info ad7091r_chip_info = =3D { .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), .convst_channel[0] =3D AD7091R_CONVST_CHAN(12), .convst_channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), - .int_vref_uv =3D 2500000, + .int_vref_mv =3D 2500, .has_vref =3D true, .reset =3D ad7091_reset, }; @@ -229,7 +229,7 @@ static const struct ad7476_chip_info ad7475_chip_info = =3D { static const struct ad7476_chip_info ad7495_chip_info =3D { .channel[0] =3D AD7476_CHAN(12), .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), - .int_vref_uv =3D 2500000, + .int_vref_mv =3D 2500, .has_vdrive =3D true, }; =20 @@ -295,7 +295,7 @@ static int ad7476_probe(struct spi_device *spi) return -ENODEV; =20 /* Use VCC for reference voltage if vref / internal vref aren't used */ - if (!st->chip_info->int_vref_uv && !st->chip_info->has_vref) { + if (!st->chip_info->int_vref_mv && !st->chip_info->has_vref) { ret =3D devm_regulator_get_enable_read_voltage(&spi->dev, "vcc"); if (ret < 0) return ret; @@ -310,7 +310,7 @@ static int ad7476_probe(struct spi_device *spi) ret =3D devm_regulator_get_enable_read_voltage(&spi->dev, "vref"); if (ret < 0) { /* Vref is optional if a device has an internal reference */ - if (!st->chip_info->int_vref_uv || ret !=3D -ENODEV) + if (!st->chip_info->int_vref_mv || ret !=3D -ENODEV) return ret; } else { st->scale_mv =3D ret / 1000; @@ -318,7 +318,7 @@ static int ad7476_probe(struct spi_device *spi) } =20 if (!st->scale_mv) - st->scale_mv =3D st->chip_info->int_vref_uv / 1000; + st->scale_mv =3D st->chip_info->int_vref_mv; =20 if (st->chip_info->has_vdrive) { ret =3D devm_regulator_get_enable(&spi->dev, "vdrive"); --=20 2.50.1 --cVstOuumvj/F2loe Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmiVupwACgkQeFA3/03a ocU7uggAoRiPHC2wByQr+p6RN1N60W24aCAwO3WQzetKKL++xTTZ5uW865wuAjz3 W0KPwY9slw0ZzP7zSNPNi1w7Nugyfmv5jx2nLKb+BHAFcIrf9iv47eaJ6uMhN/Ih bAgML2dKheCSiKOhcIbXXOLPST08Ziq14gNz/dl6W/GitYbrcHHMY+kWPqUYY4wg /dte8p+/Eu+yNiOZFci7Yy2YDIolpiqokWNIPWM/sfX9D8I3HnQKwn05MM1z58ww RlT7pNJhT9XxEysQ8kd0SCe/LX3XYlLOWu+akvlmqE44APr8cLD02rldb0WIQvNX dDROymkg7+FDtN8HM3WxiFo5YYXieA== =dMSd -----END PGP SIGNATURE----- --cVstOuumvj/F2loe-- From nobody Sun Dec 14 01:38:56 2025 Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.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 A6A0B2701B8; Fri, 8 Aug 2025 08:52:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754643123; cv=none; b=nJ2LSMNbd7Lybn3cWC2+BKIYCtmdRfeUJf+u/fBHTsSx5gUzpNX5fTbHxF0DzENCn0S2031I8dTi/61GpWafk8MfippnkZoj48HWkQN3YPdBF6cdoTp5/plupRoaGIM/FplIoqt/ufr6RVCH/S0ZpzZSBint0mIEJpMlxyTrNZY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754643123; c=relaxed/simple; bh=hXax30hPNqVdmhIcGenKACURw/1LJUIiTO6jkgNE0G4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=qywMFNpygPq2qeTTlclFRDa6+rQKXW4rhQzLMQkR+w4BXGCkrwrpnxjWJlBxat8E2P19KrSmAPKHW6URuN96oSYW3RGbpdsZGHJ4nLtAKaQZFoPeAom0BUixxHhiZfoDlXDucpnzwHFtt/BhEO001sEVE/hU9X/hhVGRrOIHlgU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MX///wjg; arc=none smtp.client-ip=209.85.208.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MX///wjg" Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-32e14ce168eso21343311fa.1; Fri, 08 Aug 2025 01:52:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754643120; x=1755247920; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=uk9uYnO2k/H8U7ZKcVEclWdd+mcBTjgDHY2cVw+2KF0=; b=MX///wjglwVSISKqtuMTf1i+rhlNyoZTK1nqKaDtrXVOYe0HbU+Z9SYLOwhFtTSL4k JCgnoYTLWQyLuvUvuw2rzaSRk4wtb/w77rPBCl9aIHnl4ZYTluWv32MHMv7AGI4wXdSE h4rmns9tsA1QP8vTjgw+YtugT3XtXzp6vrHQHZ7/Olqvk55Qth+3l51ms1K+vy4D6dz1 ZgkYtzAXdPWoFJZ4ps1BjbGnGw03JJUUwbo54GM2IN9Ww2E0HEFZmX7fUsWwRbSbDT07 5p7ig/4wsvVqYlwP1SZANfd9bGbvdl8yguAVvC3x4Pazf2Tyih6a9YWE8okRiphc23El 3HiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754643120; x=1755247920; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=uk9uYnO2k/H8U7ZKcVEclWdd+mcBTjgDHY2cVw+2KF0=; b=lTkXbVQvuc96PvzqCb3qgSow/aq4XC5ZcIRsEBBCJoyvq5uPlYIz6Tj5QW9S7VCid2 4CZx0IeLLfTwYLX6anQ/7OKm1cTqYitW4aF7I+2W2CgUaxyKEtb12JRLo0DDdVXXGo1T Izv392dRpYpHrxYxpfxs26hMerhctDVcee4R/+NTdUpg0qXQF9jjQMLK2bzQ6dec9Uvy insn6tsSKi1ldjONesho5Pv0xfcgh5hExsiPqvmQH7YogcgzYqrnWXQjaweBBi9+jI+i A+I5iEKYLTb0V70ddJVIMqZvBXkGci9lWPWloF96VJG2qXs4t2d1AcBAfZc76zMfRXD1 e4DA== X-Forwarded-Encrypted: i=1; AJvYcCULoBqJ0r6jerJCT8kG1pwL6raE8yt1UMLGs0jhlOhemRklKTCNyu9O4okUIbgHdxIZoCCKy7jYYZQw@vger.kernel.org, AJvYcCUmJhDAmwOgh9pQi9PuzSaAJSejuZMpy0XZZ33AEjVtaWs4kLssS6W8B/kf7PCKH/cs0XIkCqziH6VeoWIN@vger.kernel.org, AJvYcCVnZDJMRYoMCy2Nv/qTovWfzprqpNcF9/mQfPKwgO4wu1hbW9nlelRH6EVoGor5gPWxWq/g87wNb2cA@vger.kernel.org X-Gm-Message-State: AOJu0YzTJrjOiKqMOe73DPJyvFswCSUJxDOsrFJJFiUL5wOTigR605dS yKMUyOUv6039f+5laKCxcGkwAHBaAETOnxHUjcJyLzETAWmxx/mqyxb0 X-Gm-Gg: ASbGncvUzB7xqHpbqZAGhjm4oR52QyV9gPGRT5gk+Fq/w0RO7b4YhuSWZCaAcZsdDPo jQGpW83l5RDsgt+XVIdTYyumQuiWaLEHpWXb9fPwn/sn2gKWnVGEJhPBqPFzWh/ReTg2SxAArcd M+gfW71qH2KVma0q6+MIdd3UTocI0OhKfOl7amKf8H8IdghfuXPabbYUScyg97KhQ2s5lIgNl7t VNIrmHPIfIRhbU4myE+h7fNCggypdF6fKzC6Khw7+cEYtauefIfuUvHQ1YhsevLT/PmnJh84DGj HPTm1iLK+BbAi4z/BstZy9R5cFfWuHZSFcEwrDNPZ9Vuydh3UGL6qHts7My+U6cI3xYxM0wgNEs FpYWsDPlnWH2dNa08K/vtROG7/uL3 X-Google-Smtp-Source: AGHT+IH1PpY8CgkA5Bg3NCmK/dOoF+72ZdmthEr852KsboOQgSGFoC7KDSIhSwH8r9XEgFdJMWuotw== X-Received: by 2002:a2e:d12:0:b0:32a:74db:fe73 with SMTP id 38308e7fff4ca-333a2260534mr5613971fa.28.1754643119411; Fri, 08 Aug 2025 01:51:59 -0700 (PDT) Received: from mva-rohm ([2a10:a5c0:800d:dd00:8fdf:935a:2c85:d703]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-33250b6beddsm24847751fa.56.2025.08.08.01.51.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Aug 2025 01:51:58 -0700 (PDT) Date: Fri, 8 Aug 2025 11:51:55 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , David Lechner , Nuno =?iso-8859-1?Q?S=E1?= , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matti Vaittinen , Liam Girdwood , Mark Brown , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 04/10] iio: adc: ad7476: Use correct channel for bit info Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="czxN9WWi2bei8M1w" Content-Disposition: inline In-Reply-To: --czxN9WWi2bei8M1w Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The ad7476 supports ADCs which use separate GPIO for starting the conversion. For such devices, the driver uses different channel information if the GPIO is found. The bit information is still always used from the original (non 'convstart') channels. This has not been causing problems because the bit information for the 'convstart' -channel and the 'normal' -channel is identical. It, however, will cause issues if an IC has different characteristics for an 'convstart' -channel and regular channel. Furthermore, this will cause problems if a device always requires the convstart GPIO and thus only defines the convstart channel. Signed-off-by: Matti Vaittinen Reviewed-by: Nuno S=C3=A1 Reviewed-by: Andy Shevchenko --- Revision history: v1 =3D> : - No changes --- drivers/iio/adc/ad7476.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c index 7b6d36999afc..fc701267358e 100644 --- a/drivers/iio/adc/ad7476.c +++ b/drivers/iio/adc/ad7476.c @@ -121,8 +121,8 @@ static int ad7476_read_raw(struct iio_dev *indio_dev, =20 if (ret < 0) return ret; - *val =3D (ret >> st->chip_info->channel[0].scan_type.shift) & - GENMASK(st->chip_info->channel[0].scan_type.realbits - 1, 0); + *val =3D (ret >> chan->scan_type.shift) & + GENMASK(chan->scan_type.realbits - 1, 0); return IIO_VAL_INT; case IIO_CHAN_INFO_SCALE: *val =3D st->scale_mv; @@ -345,7 +345,7 @@ static int ad7476_probe(struct spi_device *spi) /* Setup default message */ =20 st->xfer.rx_buf =3D &st->data; - st->xfer.len =3D st->chip_info->channel[0].scan_type.storagebits / 8; + st->xfer.len =3D indio_dev->channels[0].scan_type.storagebits / 8; =20 spi_message_init(&st->msg); spi_message_add_tail(&st->xfer, &st->msg); --=20 2.50.1 --czxN9WWi2bei8M1w Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmiVuqsACgkQeFA3/03a ocVfTAf/ZXmreqOs9o2ad0tQgDoNhMfkc5dp7pSNlIbn+dp5Tb/WutJzPmtRGY2M Ku/+ba5JRgCYkOZIe+iJDDgovWhAAcZjxjtUSNMf+7QOkj4CaVr36h/Jmb+Un5lG mu/vvM6w1FpzZUHmZxU2ZTt5r8+quQtsgZ+jucKsGdx1AdBg512qk/WVffS7ug/J mi2K5UMO2gOxY9Rd8xBW2iwqN/xort19e8sTCW/khP5p6hS75Q6IogfucZ9xIkMM FqxAc+EWc3nHAVqNjjKOGV9a1FFn3EMj9mKbe/GDmNUY8GoBQJL+5M4HWADHpW+p fEYD3mWbAWNcGtsVVDblJgud0uiMhg== =Ritm -----END PGP SIGNATURE----- --czxN9WWi2bei8M1w-- From nobody Sun Dec 14 01:38:56 2025 Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) (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 126B1267B9B; Fri, 8 Aug 2025 08:52:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754643141; cv=none; b=fiDY1FCZznqzh+0Q69VOSd8vwc7IsQQW3YK57XoLomc9/Q50fBw7bC556j8zSOrDH590FgwDeAjos2BzVOtLVG+iwyLJbVdTLAe5wZmy1LYHF1fv8OT73ZEuVSrUTk5PUqh5+rX3Ov0IwoJ5jCRN63C+NFQcRmGTikA043Qq3IY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754643141; c=relaxed/simple; bh=2V7r0S/y7Yn3reyhMQjQ8huU2c0mD0XSjXPz7VuLEVQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=iJ5/GegNCumHHACpN+9FdCaCnn1kLVB06Y6BUZlfcudQwHz1wLXQdh1twFU0n6r8z6YSjlx/8tlLU0QeUFcpaJQoxPiCO6vowEfXcv0dGkWxd5i4/JijrUAtTws3qt4sWA7yWr8kQlZ6oDuF2ti8M+qIDokvg8iEEPqXviyCQ10= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=KWWKtVuO; arc=none smtp.client-ip=209.85.208.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KWWKtVuO" Received: by mail-lj1-f178.google.com with SMTP id 38308e7fff4ca-332426c78a2so14813161fa.2; Fri, 08 Aug 2025 01:52:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754643138; x=1755247938; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=SqqybCS+yNNjnY1vade3b4Z5g0zX8h8grApDt19rVXE=; b=KWWKtVuOzfeVhvz52PfxTCyDx3jOH9dFXulIs63kQbdX3/B8zOmDpvVYzpv3SgT3h/ GoPMHOiojm7QcRS/PlFRGSo7ukHW0XFqHdzhwx6FI/+PiS1btrPvrEGWbWmSf8p+0zhV 96l531Bz8lHxAMifizF31R2WLZ2CfoyiuT/5d35vBXtzw92GdPcTEkrouChHZ1fT6JXw xEYHtRQSA58/vDSYGA1V4GtZPcuoDNw9709WrLIC6HN8+GU1h/xoImnWFfuRsXjqqr8y 3cka+7lATtKHJMHzz/bHQg058Hf/l942AImk8z8MP2uhe64cky3R5rZE0ayss7zF2OGq hHeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754643138; x=1755247938; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=SqqybCS+yNNjnY1vade3b4Z5g0zX8h8grApDt19rVXE=; b=i8Z4iGNc71lF4pVbvxSflphBJ2vcGQwz1FfnZD+y6FQFK+uAKhZFDUyyms9aczwi6Z SL524XS1+TmE7dVQyTkA7L8UJa258Q85uSqze9grVGkcdT3ecchJXTAD3BZ/2YwoK0lR cNEe9oTF/X81nWNL6ZpGHpggjm07Tjq+ZaNIBgxyBtamUk3wB2MJWGxORPLm/6FcBjEY XVOgfmta1TEBJ+flq4WCApPqYczEGX8xD7w7tK81w8qEesN/j2IgNblNSOmvY+J2KNLl axrfrfW4Rbur9BmUGZA5R9e41VLK7BOissKgmKHSB2bzXQuafh3CEed+VBRAKZRDSan2 PxUw== X-Forwarded-Encrypted: i=1; AJvYcCVpwidu/yGH9S6Qvqhjo3bwNUCRvY5JB4IT62dZn13PmxrvCBcsudcrcB8x2/9UOJEUbLqbFafzAXWQn8HR@vger.kernel.org, AJvYcCW+QlFSdIpSKLdbyg5n5dB7vcNc7MeEuc/HVIs/ZoYSc+WvAbC0nImVNMYSddFNUTMTOapv84QRLRoE@vger.kernel.org, AJvYcCWM1rmSCjuw04Y2nXqIcpbMZVi+5pY140j/WBcNxiFA3hAlQ+m3+cdZUI8T48owKSvfh4ilV9qXSqnT@vger.kernel.org X-Gm-Message-State: AOJu0Yxlnvd9yyzgjVTts+vS763289s/On686jTFCjzqCQwbHNjsBbyv As022dhjxRJYLfx/0Gn+xnDn2JvNkh7pGSTcBIToHDu0FswdWWjBKhA0 X-Gm-Gg: ASbGncv0dY9boxA6zuJ9o75k6v1KceVLPTS5Txo50DqqyMQ0A7cSpIDc47pNF5ur4KS Of7yFnCLuAKF4De3yoGygyJlAmwxFoXDI8KURoHX71FbUuKmzmuOKo2mQHMTzrltC+mx9O3RIO/ ByoixOhwDBlVUxAHhw02Hfug5V/9TMNLoJ8n+MQ6bOxIqCUUEXmwWLKx5CAn1mm4oJ1ACfcWAP7 da3gKEztwyUKVHYZneqVf1u1JfXdovwHXAcdyU+WqOZTO1S+QuKIeNZrNMTcxKr1mJA1d5Z0Wyx eqCEturaG1FX34Rr56Ahydk+Okdx1h6z1TsO66d+MT9mM98ekbnNL06Q5wzrTxYFCf962ngUaDn L27+UGMoO7Jen5Wx29dUyxyP2mBzb X-Google-Smtp-Source: AGHT+IG9sOAPfAkQX+6RML35fUUokX08NVm/JmPUhkRV1bRAEf9SgmB/9YYav7nfc9PhlTWM52AtLg== X-Received: by 2002:a2e:742:0:b0:32a:77a3:8781 with SMTP id 38308e7fff4ca-333a225f9eamr4822761fa.30.1754643137963; Fri, 08 Aug 2025 01:52:17 -0700 (PDT) Received: from mva-rohm ([2a10:a5c0:800d:dd00:8fdf:935a:2c85:d703]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-33238911615sm28143851fa.72.2025.08.08.01.52.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Aug 2025 01:52:17 -0700 (PDT) Date: Fri, 8 Aug 2025 11:52:13 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , David Lechner , Nuno =?iso-8859-1?Q?S=E1?= , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matti Vaittinen , Liam Girdwood , Mark Brown , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 05/10] iio: adc: ad7476: use *_cansleep GPIO APIs Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="LhvDpW6zAb6SfMi9" Content-Disposition: inline In-Reply-To: --LhvDpW6zAb6SfMi9 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The ad7476 driver supports ADCs which require a GPIO pin to be used to start conversion. The GPIO line status seems to be always toggled from a process context, either from the user-initiated "raw-read conversion", or from a threaded IRQ handler. Furthermore, these ICs are connected via SPI bus, which is usually implemented in a way that the access to the device can sleep. The GPIO here is toggled from the same context which is reading the results over SPI. Thus it seems very likely these GPIOs are toggled from a context which can sleep. Swap the gpiod_set_value() to gpiod_set_value_cansleep() accordinlgy. Suggested-by: Nuno S=C3=A1 Signed-off-by: Matti Vaittinen Reviewed-by: Andy Shevchenko Reviewed-by: Nuno S=C3=A1 --- Revision history: v2 =3D> v3: - New patch --- drivers/iio/adc/ad7476.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c index fc701267358e..1445f0f599d9 100644 --- a/drivers/iio/adc/ad7476.c +++ b/drivers/iio/adc/ad7476.c @@ -57,9 +57,9 @@ static void ad7091_convst(struct ad7476_state *st) if (!st->convst_gpio) return; =20 - gpiod_set_value(st->convst_gpio, 0); + gpiod_set_value_cansleep(st->convst_gpio, 0); udelay(1); /* CONVST pulse width: 10 ns min */ - gpiod_set_value(st->convst_gpio, 1); + gpiod_set_value_cansleep(st->convst_gpio, 1); udelay(1); /* Conversion time: 650 ns max */ } =20 --=20 2.50.1 --LhvDpW6zAb6SfMi9 Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmiVur0ACgkQeFA3/03a ocUXfggAzAND4GqFGEp3idk05Gg6jT1aQ35536iPv10DIMSBio3AhNKGA1FYDJVL 5GIkLbDH2+7Wfb+Xdkb+UaU5pmffqJqmVNGz1PtQOj3o/YZAHXAZdKIKlQ8J8NLL jnlTF39J059Q7XZW4ajOM53T3fqdsoF0zrL8FRNpPmcZNp9or5Do5VNyyNDyfAQa Z7EqQu6NHI59t01OApXtJRVxSxEs1bt7efLo9D2kl+6fwStJ3n+3KplT3B/QnLlL vOaB5J/P1yaE6YXaLS28Jv94ztPv3fB4ZWzLfKGN1uM9azSa85AIQ65EgoZitIOE IkX0qSKTeZX7GCbmJUG15If7mTwzUA== =uqj9 -----END PGP SIGNATURE----- --LhvDpW6zAb6SfMi9-- From nobody Sun Dec 14 01:38:56 2025 Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) (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 E3D28266EFC; Fri, 8 Aug 2025 08:53:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754643219; cv=none; b=GRxMt729cx8EWdBQkQJEmPhBk2611ttJXhtie/XGJDp/6pAeXMNVFDHLVa9+lRJtRj8+PsffteI/nDKu0i4eEQ9pm81Qidz15/C5A5+5d41gXaNjW8a/Ql0En+jj33ElbM78eW1zvBC8dFyDIWuKrK2/un6EcYvDyOFTW0ztM/M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754643219; c=relaxed/simple; bh=sGcmvCCkuD4TFvA9CCB58Xk9MMl4mueGmFJlTd+8tI0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ByLX+ClLMraHg6CWwGttaXZJGThFPo3c3dcvgV6erQHtIltsMjyvkWS3DF0pNdB7H6K3fkyAWSfH4BvXZE4A8+O7RSwMBt+8N2/1LIdHbQG2ll6ArWF94tDndpfvqdI/ryvGZPeYeQoBaqEZF56YGN1Zun7DqQzd1HdZB5pVAK8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=kxzo5hen; arc=none smtp.client-ip=209.85.208.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kxzo5hen" Received: by mail-lj1-f178.google.com with SMTP id 38308e7fff4ca-3322a34e84fso17053051fa.0; Fri, 08 Aug 2025 01:53:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754643214; x=1755248014; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=TC755O3UA0g/O5J4PLl4KCN+52Xn33ErgZAEv4wP64g=; b=kxzo5henD+c/i3ZX7GctUaaeXJwujxm8pGLAynpTegXmDpYxuvf0BbuYLElpI0aNOA UJO9kIPBx+t9JuLucfwV64AF5WgQXwp6AD3omAyyg+JViHGznR9zRoHHnNVchauH9Zf5 RZifWhWwsqaTU/Hm/nkb7LtHu86nBDYflc5FCPR6iHEg4zDPgntagZZ79mSHCFuNaibw 6n+YJn7yyL0zOFeP9oMM2IyolpMzCGNm9NeYZwO2HWVOPdeDtr1Vtb9mxvZ7/i2YtTp1 RHcp+PilDLN8Z87EMTqSPygPQEb45Z9ZBku2nDX3eV5p704Q4EnJeJNPQ3QSUeH2Zy80 aLGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754643214; x=1755248014; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=TC755O3UA0g/O5J4PLl4KCN+52Xn33ErgZAEv4wP64g=; b=MBqPf1P/hm6pZiCsMtEVn9eIar7JY9UwTM9T0+9s2Nn2StMxQzze8PaQturMr4BNRq Txo7GiUnB/dUshikJJ/TYDo+KECDj11AMq5YhJHPonnMkxFqbhjJTRK6KJT0pR0Cd2EM kVuOZ1BdiYbi7KNk/JItXFRFezQr3G6zlA9mvz8maPQdsfnEmGPTudAibKvph9ubJEpX Hx8xzxgDzTlpOcNaHjO6YLJbGuaHUrmU0u/Y/568/5XYq1mEBTtvEUOUYXXVjBmRb3gN OjNDpbOV1beTgLwLCaAOiJJdV/GEAM/52ydVQfZC4FeXR3yZ8Qgf4X1mUnfoVpcDt5cT dGOw== X-Forwarded-Encrypted: i=1; AJvYcCUSSxHCTcFzbpL/IrLZsAwAMKw5dzZiQ6niNAka9GVaaU1T+b0VKThFIK5sqGW2KllBm+DYug4oYqeCFoHY@vger.kernel.org, AJvYcCVvvCCav7iHbUMnMlZ0L3XZjzCl9pv4D1FzVKWeDSoXveWiMz+C9/YN6759jax3uvoW5qji/Y2JmOFK@vger.kernel.org, AJvYcCWaMBfTVESNQ2WwjmHHTG0jG+NFIvuzKLkH3iDRsMw52vZZrSNUirTDAo9sLXVNgjXBwabY05JEaZYY@vger.kernel.org X-Gm-Message-State: AOJu0Yz/JyfbJ88qj5y61UGjfkTwH21S5nDfYQLElw0DyQN0QXoIZpWK 3b3q7Dd3H3D5YAudjfPjgg7bMhCF9YaoLY14EWFlaDd/3Qqmu6UJqfeg X-Gm-Gg: ASbGncsx2/5SEWHk7d2WXA1YvDmBlM7s/73hTQblHxnXSnYmtjQpOGjgaS6PhJXWXTG 3nSqjDxbUd0u4HIhEC5/bAio/aHvZ0OD37O0SlfFV+IVmkFZPpBMUvB5msWW2HpWGfm9/gIcfoN hzVPlpftaXYiBYrXchFJOkJOMjurtef6GiaaUXGlatDIjCm83cy+iEVwxUhz19GcUHjvAnkfjzh RjV+kPfg4ywyLM+bomOdiCOzVt0nhP1+7uqf/S7J1IjqWSYW1hFKDOmHZqn9a+cUfDjelIyt52J 833AEyXmZ989KRFXaMmuocebKO/JcRiLk2JJp+zLIrBp2zr/cmKrvvZBu5UqKywp0PBkNZt2m4H CqiL/uSlpPGQ0GHtRi5n7u3i1dmcP X-Google-Smtp-Source: AGHT+IHEY7XI84xB5fZ8gDYWIsh/qgurALzwFw49Z1QNlCZibQFaYU9lAwVmSYbQNmJKbawQ6HKxlQ== X-Received: by 2002:a05:651c:f02:b0:332:6304:3076 with SMTP id 38308e7fff4ca-333a2148f34mr6475291fa.1.1754643213769; Fri, 08 Aug 2025 01:53:33 -0700 (PDT) Received: from mva-rohm ([2a10:a5c0:800d:dd00:8fdf:935a:2c85:d703]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-3327e325a42sm11684241fa.59.2025.08.08.01.53.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Aug 2025 01:53:32 -0700 (PDT) Date: Fri, 8 Aug 2025 11:53:29 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , David Lechner , Nuno =?iso-8859-1?Q?S=E1?= , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matti Vaittinen , Liam Girdwood , Mark Brown , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 06/10] iio: adc: ad7476: Drop convstart chan_spec Message-ID: <8ed500a973d14460f541f1701e4423eb11b1f179.1754641960.git.mazziesaccount@gmail.com> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="V2qZQqwVIAoZBGk9" Content-Disposition: inline In-Reply-To: --V2qZQqwVIAoZBGk9 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The ad7476 driver defines separate chan_spec structures for operation with and without convstart GPIO. At quick glance this may seem as if the driver did provide more than 1 data-channel to users - one for the regular data, other for the data obtained with the convstart GPIO. The only difference between the 'convstart' and 'non convstart' -channels is presence / absence of the BIT(IIO_CHAN_INFO_RAW) in channel's flags. We can drop the convstart channel spec, and related convstart macro, by allocating a mutable per driver instance channel spec and adding the flag in probe if needed. This will simplify the driver with the cost of added memory consumption. Assuming there aren't systems with very many ADCs and very few resources, this tradeoff seems worth making. Simplify the driver by dropping the 'convstart' channel spec and allocating the channel spec for each driver instance. Signed-off-by: Matti Vaittinen Reviewed-by: Andy Shevchenko Reviewed-by: Nuno S=C3=A1 --- Revision history: v2 =3D> v3: - Use __set_bit() instead of |=3D - Swicth BUILD_BUG_ON to static_assert - Clarify a comment - Improve commit message v1 =3D> v2: - New patch --- drivers/iio/adc/ad7476.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c index 1445f0f599d9..ad9e629f0cbd 100644 --- a/drivers/iio/adc/ad7476.c +++ b/drivers/iio/adc/ad7476.c @@ -6,6 +6,7 @@ * Copyright 2010 Analog Devices Inc. */ =20 +#include #include #include #include @@ -29,8 +30,6 @@ struct ad7476_state; struct ad7476_chip_info { unsigned int int_vref_mv; struct iio_chan_spec channel[2]; - /* channels used when convst gpio is defined */ - struct iio_chan_spec convst_channel[2]; void (*reset)(struct ad7476_state *); bool has_vref; bool has_vdrive; @@ -42,6 +41,7 @@ struct ad7476_state { struct gpio_desc *convst_gpio; struct spi_transfer xfer; struct spi_message msg; + struct iio_chan_spec channel[2]; int scale_mv; /* * DMA (thus cache coherency maintenance) may require the @@ -154,24 +154,18 @@ static int ad7476_read_raw(struct iio_dev *indio_dev, #define AD7940_CHAN(bits) _AD7476_CHAN((bits), 15 - (bits), \ BIT(IIO_CHAN_INFO_RAW)) #define AD7091R_CHAN(bits) _AD7476_CHAN((bits), 16 - (bits), 0) -#define AD7091R_CONVST_CHAN(bits) _AD7476_CHAN((bits), 16 - (bits), \ - BIT(IIO_CHAN_INFO_RAW)) #define ADS786X_CHAN(bits) _AD7476_CHAN((bits), 12 - (bits), \ BIT(IIO_CHAN_INFO_RAW)) =20 static const struct ad7476_chip_info ad7091_chip_info =3D { .channel[0] =3D AD7091R_CHAN(12), .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), - .convst_channel[0] =3D AD7091R_CONVST_CHAN(12), - .convst_channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), .reset =3D ad7091_reset, }; =20 static const struct ad7476_chip_info ad7091r_chip_info =3D { .channel[0] =3D AD7091R_CHAN(12), .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), - .convst_channel[0] =3D AD7091R_CONVST_CHAN(12), - .convst_channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), .int_vref_mv =3D 2500, .has_vref =3D true, .reset =3D ad7091_reset, @@ -282,6 +276,7 @@ static int ad7476_probe(struct spi_device *spi) { struct ad7476_state *st; struct iio_dev *indio_dev; + unsigned int i; int ret; =20 indio_dev =3D devm_iio_device_alloc(&spi->dev, sizeof(*st)); @@ -332,16 +327,28 @@ static int ad7476_probe(struct spi_device *spi) if (IS_ERR(st->convst_gpio)) return PTR_ERR(st->convst_gpio); =20 + /* + * This will never happen. Unless someone changes the channel specs + * in this driver. And if someone does, without changing the loop + * below, then we'd better immediately produce a big fat error, before + * the change proceeds from that developer's table. + */ + static_assert(ARRAY_SIZE(st->channel) =3D=3D ARRAY_SIZE(st->chip_info->ch= annel)); + for (i =3D 0; i < ARRAY_SIZE(st->channel); i++) { + st->channel[i] =3D st->chip_info->channel[i]; + if (st->convst_gpio) + __set_bit(IIO_CHAN_INFO_RAW, + &st->channel[i].info_mask_separate); + } + st->spi =3D spi; =20 indio_dev->name =3D spi_get_device_id(spi)->name; indio_dev->modes =3D INDIO_DIRECT_MODE; - indio_dev->channels =3D st->chip_info->channel; - indio_dev->num_channels =3D 2; + indio_dev->channels =3D st->channel; + indio_dev->num_channels =3D ARRAY_SIZE(st->channel); indio_dev->info =3D &ad7476_info; =20 - if (st->convst_gpio) - indio_dev->channels =3D st->chip_info->convst_channel; /* Setup default message */ =20 st->xfer.rx_buf =3D &st->data; --=20 2.50.1 --V2qZQqwVIAoZBGk9 Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmiVuwkACgkQeFA3/03a ocVy6wf/ZYuGJWJpzIqcvSLPQw6/tQ5+0bhjuMvUuOe3PLclUwVyMaP0/cRgS1bW nzKBl6bij50L2USUzXvFl44WIV4YiturebYRmHNjmRZGROlzFDt5Iy7a7WqVl0y/ vDQWzKPUikYrrAUEmCNjzwQlQsI3FLLpeCcPFdG94wphIJLtRpIxcZF7iGdoWUia WlgifxsgwxfbPUNsh2oTGMe/E5v5udEuo+0NKW8VptJHBpM8ZuYPwQK823op0okg DYUNs8aweAGJfScerU4ilBpsgBPcBq8181/PqLdG9vM9pc8WEUfNDoy7TTwsemyM cysnuue2juUXJoqphaybcLs/a19UtA== =jXgG -----END PGP SIGNATURE----- --V2qZQqwVIAoZBGk9-- From nobody Sun Dec 14 01:38:56 2025 Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (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 4328A2690C4; Fri, 8 Aug 2025 08:54:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754643258; cv=none; b=pspxTE9XKCFjyJpay6VRqB7aqvrMd8UAUFpZGYeCTkSP13LnD5ZfnijuxljiZ3jOjaoYto9XaAYoZaavI4Veqnlw3hcdhg5SMYs8k2VB+VQLrhRR+3HYSNaNnB57Lqy9yOzUoazHTlLo0O0SwavY6i+GR5+p3B/u8RiIl9lUwOk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754643258; c=relaxed/simple; bh=nMzDRldyT6gamGZ8y4MMUQ0ws1QkdVOzdQy0YqPLcwo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ozTmspt9PeaDroswemGLwotbHOcsT0rX7hKUiFKFQlAyuoz41Gg/av5/bKVq+nUC+vsMRLcsuKB4ocx8TrGL4f02wSU+Pl57mSuFS/1O9jkf/KElo3d5WXN5hFVjPxTHQvGLsPLlTi+gW74vvNTAG40JWMQl+lqgPRJTzDCxAss= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=T1Cd4uvj; arc=none smtp.client-ip=209.85.167.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="T1Cd4uvj" Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-55b8b8e00caso2297526e87.3; Fri, 08 Aug 2025 01:54:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754643254; x=1755248054; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=RWogjGnTRuwcmlfIkxh4lLwLazo54YDHCMD6nS/8DMA=; b=T1Cd4uvjTCzzb2zS9bgFwfVZNJvRyIktPDS/u+GqmuMEv8kVuQ9iSgO4htJzDDCG8l GotGTvVrLZ4kbGBX66b1MBTwKa+ZN06bsl7KL8chyMRuyrUaIHVbhSs7/GV1TGx/k0k2 0XWLfqK/YBG78eErqlR7+he1bP2n+Nc9A3IVJY7M83n4Jzz0b2CpuVMt47YOTUSBn8u+ MOLNC2OXFJ6jLTa7rxtAZLmqAtr3IBfdbRBpd0ULkVa9Knw/bG7tsaOJKpu/R4CnMr7o BM6DecPpYGMfKuLVTuSM92h+keGkepE4jmI8LGYOOLK9AjZQH9SE/LsAq2Rxb0CwjeK1 062Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754643254; x=1755248054; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=RWogjGnTRuwcmlfIkxh4lLwLazo54YDHCMD6nS/8DMA=; b=PleVK5f7HzuhwJQonCZjQFtbwulpGZTlebShVykTkccOv68AP1op2b8Dd+aBFUZbSf 1uXAk836dpm24RLC8toTGTnvKcCG2QdZdlAGl0yxrQDs/dXRExstHjRjTAZG+8f5xrmR GXdBaM8dtc3WfXiS54VB47GyP/pu3YAsxCCueYCfy+5B6whUV0lpoukN80Oz+FQNiP7w QQchAsPhF/sy/pUQKmXkE+cJ4DUjrHLMBxOkUzt+EgkCO+36v/qzPnE9r2NghPxK/+Wn QA8tJ/gF115ShEIqx5qaBultXCcBlD5Ft6Apw9vvd+/XClfNM5da/BNgG1sa5sCrZinQ GFpw== X-Forwarded-Encrypted: i=1; AJvYcCUayg3H13Tny75zZ/xscgGzSe+Di/VWxgsLNmb7p1Zb/6zycgsi8iYAyGROL8wOsIT3ndssufn4CtkAx5mK@vger.kernel.org, AJvYcCWk0mWLISVOZMIx2cCrksYN5LrZDqcJOnwhP/9vMViktWUAE77EhvT53fHqTNcoL/mi+63NOj3RxHis@vger.kernel.org, AJvYcCX36fJlT0S/TmwLzMB/4azNBg5U8cd7tGyggjeJAOr7kPRhvAIYsz7qq/z4JfN8uQdnfnimOpm724Hv@vger.kernel.org X-Gm-Message-State: AOJu0Yzoyvn2JkbVDV9wKKd6JfYgSmZR/3VmVGLO6ohI/QYCImQ4Lj49 vNDxRYc6OUJjd/ESKAc9PN8u0jKczdQCc0alziFPGIL3m7waAjk/eMMC+bMgWg== X-Gm-Gg: ASbGncs1Fcg1K6YSmgSSOLKo2kuMSfDiX0aOB8s1a409C84KHjhMV94RmFYbITW69cS Pd4vvZXmrPJz44byTxm4z/BTc/eAn9hYY+692Otc3y+wVGgzKN2XzNjJHjA4pOczX2eMUftp4Fb zQQs3JuMrdVpju27SXhqxn3+rlotBx8RfMFJsef2A5VNdLd7XAgdG3r9tRUpA55zcL5TphshbX2 skftrfqdpZkQJWGudNNkFzIUHq9uBD/gcvuIxY/bY57XUrA4LyjTCSenWrezfJJcuv4TJwAMQ84 1uydUaqo7g3hvNOzZBKznkV4gVEcDFeh1Krm4ynMe3YpcDVV7nvz70ZyMCLdVQrx7+ernd6D714 UZmh9X/WFjyL2vuUWCvaTB1+4vBSv X-Google-Smtp-Source: AGHT+IEDsSSIgbWeg2vqcDdGPmOdqerKcyBcMFifPi1Cnby+NU76x4CeDPpiP3/6+DXb9iajdac3lg== X-Received: by 2002:a05:6512:1591:b0:55b:8a07:7917 with SMTP id 2adb3069b0e04-55cc00fd54fmr520067e87.30.1754643254150; Fri, 08 Aug 2025 01:54:14 -0700 (PDT) Received: from mva-rohm ([2a10:a5c0:800d:dd00:8fdf:935a:2c85:d703]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-55b9f77a1fbsm1912310e87.121.2025.08.08.01.54.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Aug 2025 01:54:13 -0700 (PDT) Date: Fri, 8 Aug 2025 11:54:09 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , David Lechner , Nuno =?iso-8859-1?Q?S=E1?= , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matti Vaittinen , Liam Girdwood , Mark Brown , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 07/10] iio: adc: ad7476: Conditionally call convstart Message-ID: <57284a156afeb1531fae39897eba4e73d90fa5b9.1754641960.git.mazziesaccount@gmail.com> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="MgcP2BfGJn65CyD4" Content-Disposition: inline In-Reply-To: --MgcP2BfGJn65CyD4 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The ad7476 supports two IC variants which may have a 'convstart' -GPIO for starting the conversion. Currently the driver calls a function which tries to access the GPIO for all of the IC variants, whether they support 'convstart' or not. This is not an error because this function returns early if GPIO information is not populated. We can do a tad better by calling this function only for the ICs which have the 'convstart' by providing a function pointer to the convstart function from the chip_info structure, and calling this function only for the ICs which have the function pointer set. This does also allow to support ICs which require different convstart handling than the currently supported ICs. Call convstart function only on the ICs which can support it and allow IC-specific convstart functions for the ICs which require different handling. Signed-off-by: Matti Vaittinen Reviewed-by: Andy Shevchenko Reviewed-by: Nuno S=C3=A1 --- Revision history: v2 =3D> v3: - Use indirect call to convstart (via function pointer) also from the ad7476_scan_direct(). - Adapt to the change which returned the chip_info pointer back to the driver's state structure. v1 =3D> v2: - Adapt to the change which removed the chip_info pointer from the driver's state structure. The follow-up patch adding support for the ROHM BD79105 will bring different 'convstart' functions in use. The IC specific pointer will also prepare the way for this. --- drivers/iio/adc/ad7476.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c index ad9e629f0cbd..6cb2cbeafbd3 100644 --- a/drivers/iio/adc/ad7476.c +++ b/drivers/iio/adc/ad7476.c @@ -31,6 +31,7 @@ struct ad7476_chip_info { unsigned int int_vref_mv; struct iio_chan_spec channel[2]; void (*reset)(struct ad7476_state *); + void (*conversion_pre_op)(struct ad7476_state *st); bool has_vref; bool has_vdrive; }; @@ -70,7 +71,8 @@ static irqreturn_t ad7476_trigger_handler(int irq, void = *p) struct ad7476_state *st =3D iio_priv(indio_dev); int b_sent; =20 - ad7091_convst(st); + if (st->chip_info->conversion_pre_op) + st->chip_info->conversion_pre_op(st); =20 b_sent =3D spi_sync(st->spi, &st->msg); if (b_sent < 0) @@ -94,7 +96,8 @@ static int ad7476_scan_direct(struct ad7476_state *st) { int ret; =20 - ad7091_convst(st); + if (st->chip_info->conversion_pre_op) + st->chip_info->conversion_pre_op(st); =20 ret =3D spi_sync(st->spi, &st->msg); if (ret) @@ -160,12 +163,14 @@ static int ad7476_read_raw(struct iio_dev *indio_dev, static const struct ad7476_chip_info ad7091_chip_info =3D { .channel[0] =3D AD7091R_CHAN(12), .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), + .conversion_pre_op =3D ad7091_convst, .reset =3D ad7091_reset, }; =20 static const struct ad7476_chip_info ad7091r_chip_info =3D { .channel[0] =3D AD7091R_CHAN(12), .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), + .conversion_pre_op =3D ad7091_convst, .int_vref_mv =3D 2500, .has_vref =3D true, .reset =3D ad7091_reset, --=20 2.50.1 --MgcP2BfGJn65CyD4 Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmiVuzEACgkQeFA3/03a ocWDrAf/cJ7BfiUMPb+mT/65RXiU+d/OYqvkHvOu/SEjFt0mZkg8WuUL+BG670XU gC1TvWjFV4fFUTpigq0wAHyrv6ILMKzS2qFVzSbXip5QBReqjs1QRhLsJkC+j0Uv F43L3W6HYfuFZe9HZUjNXHgqs3ykXhEzYcMJt6776/tIujyK/erqqDCSAcGBVQCE wqIa0lWypN4lyYSmZjLedno58s2pA/qiEZq/ACLgeiNCx7AyR+XihXXENVDJLqA8 8z7gGcw+ITri6S2kh1O6UGuvoky96PEhotswYtZUPTNX97nJK46eLlCCqP1zwoMQ 7uOGBd3Q5aZRU5kmBGellJLLP/gRrQ== =sPUM -----END PGP SIGNATURE----- --MgcP2BfGJn65CyD4-- From nobody Sun Dec 14 01:38:56 2025 Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (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 7865D2690C4; Fri, 8 Aug 2025 08:54:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754643274; cv=none; b=WIYyaQ5Nk5vB7JgIKmHncsPOrc5VIKf325SYFkDdZgkeoSX5t97MDiXP+xZ8ac4J/+xqguhiwOyYLPjlvAoGz+VY0pdp0Fp2ANUQDhTeDbkwOnTbP5kXQMkE9YopOS/pkc6LCs2bg17rT2Je28QXUCSvQc7tDhOSElYVGqNTMww= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754643274; c=relaxed/simple; bh=OiR/2HnHwk3hu8f6SamcIhgWgOSPUE9a9pwFjFj4Qp0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ORBSj2HEsGz5HLswgoEAHeJT7eNp/eCVJNo/17Vhu5HwaYruyey2UUDbc+MpoD6AtAOzDFoyXHfJoWEPlvIrA86zGlOsYTlUDlCUs8asGpNp/Hu/aNCuDyQHRhVtTcc4MNq40w0YGe1N0bhAY7xL67ppwgouNSBVQnN/MAhYziU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=EUg9XPQf; arc=none smtp.client-ip=209.85.167.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EUg9XPQf" Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-55b7454c6b0so2032202e87.3; Fri, 08 Aug 2025 01:54:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754643269; x=1755248069; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=GJXYbABixyTOaHOtiXscD+YAY82rcQaoMNZVj4YOt9Y=; b=EUg9XPQfy1E/s8MiCkGOyS1ZSW78r1xUibPyzdh64T6fSGAvgPszVaTYA+2I3UA46y 5nbLCs50oyVGmaIQFG32eGYcx4jIGWaNQ441OhbAGGq2fSul6YS4w+dPY08Ie+XEU8lR lhyaOHQmHSweaZR9dEub8hxzidpWDEybNaM6GN74i6EVpFnRaercNDQNk7mlahfzPPnr vU3fwgOvDv65aJ02ExmOJmLg/W6PpnQAfsOhg/PPCNWbAJ12uxNj+1e1T0YG8fNmsVKL IXzft6++F/TtDE+HiyFBv5UrX0RE02+A1a/Fbe+gpdidLjW558nt35D2ASiZ6ZUxGGBq 6law== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754643269; x=1755248069; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=GJXYbABixyTOaHOtiXscD+YAY82rcQaoMNZVj4YOt9Y=; b=B4XQsxtdb5PgdqUmB7RNKLt2Wg8zKuOfza3tYu1/lB1EfW9uYnLTJodZNc5G3m3IIg HjIDvnFI9Q2Lx2yS2V1o/M47SrAIiqeJk6ls2N7GrPnB2dCjOhg2Kn46yJFUQuaoafqc 86XnkM2N2FgBpfCMv+6/gPu8zlT5IIUeYdxo5gbiomW+QzlbUc5IVduAjOrZ4gnk+9dX aTzcT8+Ik+Groh5wKN5fpKGH/klwc6K344vpenxx2fZwvVq/oRBn9kUj7DD/sYR4AD+1 6RK4Yi018icSZNY+XQ0GP7gglviRrwAaK/Gi6KyfIHuNHoddg4LZ/norj6GngbW6xV46 XFfg== X-Forwarded-Encrypted: i=1; AJvYcCVq2CGOTnIrhFpwmq+9bTTkUbbTSkQ29Nb6AS5glAhoM1iCDnim3aWrvUh2glhqfloTlh6L1vElIjQP@vger.kernel.org, AJvYcCW91gQdXPPUdolAJoyWa1mjXAJC7MJtPAvsqMchogxWn98b5bLR3C1NVIYwPnCQyneJ43oTxTBSJRY7o0qI@vger.kernel.org, AJvYcCXrGzZqqazfKYPn71uwgJYHkcQpilp1lNFybzgoeCKWrL8G6mMMwv7SiRGdI0miciyCQUCz+gT+B0U8@vger.kernel.org X-Gm-Message-State: AOJu0Yxonl6su3cc8RdVNIGdhphFyveUN7OwoznA7SR+3sUzmaXo9Ilh avSbv5l1jSAzpp4wPziSxPrOINSzX+050v7QSd5LVE439+/b8Q19HySp X-Gm-Gg: ASbGncueSCeWY8wm5ksKTaUmgQ+nSwP8//U3ImL7QFrayuYqZNAIgQ3tUq/vCGsEJme YzwDjhXAFBC/jXWlysG9uIEE7SMPYtjWOTj97afV2pcn6m3ZU1qCY8L7V3vo+ZHCJZXZj1bou07 ch4m3OPwNbUaEpsmXEGew74QgPm34ptckwsGblBru9eszlqARdr75lNgW1iJFQYt8ZuDonKtd1V wv/ewFflpykhv231G3iQTVyIRkfUXTcxvf76NNHT1xqxDba9qnaaY3K6btpZHHa7xNUAvziwDBi ZIrWe1OdDKPFKm13Vj4YZnQmMVjujMsAtqb1/xJq15sw6M73ZCyS0KFENf/SlJ73JpreNoZ+CF7 IFqS8O6htmzDsbth6IQYwF3cKtC4z X-Google-Smtp-Source: AGHT+IG6+zQUBeiPdqX1g2jivVW56r5EB4sFlrYO+u0gHY0UIcG4wiioSFcEo94BfT3o6rO+2EB62Q== X-Received: by 2002:a05:6512:2211:b0:55a:e1f6:bd98 with SMTP id 2adb3069b0e04-55cc0083b04mr542983e87.6.1754643269329; Fri, 08 Aug 2025 01:54:29 -0700 (PDT) Received: from mva-rohm ([2a10:a5c0:800d:dd00:8fdf:935a:2c85:d703]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-55b887f72f4sm2979768e87.0.2025.08.08.01.54.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Aug 2025 01:54:28 -0700 (PDT) Date: Fri, 8 Aug 2025 11:54:25 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , David Lechner , Nuno =?iso-8859-1?Q?S=E1?= , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matti Vaittinen , Liam Girdwood , Mark Brown , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 08/10] dt-bindings: iio: adc: ad7476: Add ROHM bd79105 Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="f2LLsVrY0GN/V41a" Content-Disposition: inline In-Reply-To: --f2LLsVrY0GN/V41a Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The ROHM BD79105 is a simple, 16-bit, 1-channel ADC with a 'CONVSTART' pin used to start the ADC conversion. Other than the 'CONVSTART', there are 3 supply pins (one used as a reference), analog inputs, ground and communication pins. It's worth noting that the pin somewhat confusingly labeled as 'DIN', is a pin which should be used as a chip-select. The IC does not have any writable registers. The device is designed so that the output pin can, in addition to outputting the data, be used as a 'data-ready'-IRQ. This, however, would require the IRQ to be masked from host side for the duration of the data reads - and it wouldn't also work when the SPI is shared. (As access to the other SPI devices would cause data line changes to be detected as IRQs - and the BD79105 provides no means to detect if it has generated an IRQ). Hence the device-tree does not contain any IRQ properties. Add a compatible for the bd79105. Signed-off-by: Matti Vaittinen Reviewed-by: Andy Shevchenko --- Revision history: v2 =3D> : - No changes v1 =3D> v2: - BD79105 can provide data-ready IRQ (or GPIO) via DOUT-pin. --- .../bindings/iio/adc/adi,ad7476.yaml | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/Documentation/devicetree/bindings/iio/adc/adi,ad7476.yaml b/Do= cumentation/devicetree/bindings/iio/adc/adi,ad7476.yaml index d0cb32f136e5..c411a7467651 100644 --- a/Documentation/devicetree/bindings/iio/adc/adi,ad7476.yaml +++ b/Documentation/devicetree/bindings/iio/adc/adi,ad7476.yaml @@ -41,6 +41,7 @@ properties: - adi,ad7910 - adi,ad7920 - adi,ad7940 + - rohm,bd79105 - ti,adc081s - ti,adc101s - ti,adc121s @@ -55,6 +56,11 @@ properties: reg: maxItems: 1 =20 + interrupts: + description: + The data-ready interrupt. Provided via DOUT pin. + maxItems: 1 + vcc-supply: description: Main powersupply voltage for the chips, sometimes referred to as VDD= on @@ -75,6 +81,10 @@ properties: description: A GPIO used to trigger the start of a conversion maxItems: 1 =20 + rdy-gpios: + description: A GPIO for detecting the data-ready. + maxItems: 1 + required: - compatible - reg @@ -82,6 +92,20 @@ required: allOf: - $ref: /schemas/spi/spi-peripheral-props.yaml# =20 +# Devices with an IRQ + - if: + properties: + compatible: + contains: + enum: + - rohm,bd79105 + then: + properties: + interrupts: true + else: + properties: + interrupts: false + # Devices where reference is vcc - if: properties: @@ -115,6 +139,7 @@ allOf: - adi,ad7274 - adi,ad7475 - lltc,ltc2314-14 + - rohm,bd79105 then: properties: vref-supply: true @@ -131,6 +156,7 @@ allOf: - adi,ad7274 - adi,ad7475 - lltc,ltc2314-14 + - rohm,bd79105 then: required: - vref-supply @@ -141,12 +167,28 @@ allOf: enum: - adi,ad7475 - adi,ad7495 + - rohm,bd79105 then: properties: vdrive-supply: true else: properties: vdrive-supply: false + + # Devices which support polling the data-ready via GPIO + - if: + properties: + compatible: + contains: + enum: + - rohm,bd79105 + then: + properties: + rdy-gpios: true + else: + properties: + rdy-gpios: false + - if: properties: compatible: @@ -154,6 +196,7 @@ allOf: enum: - adi,ad7091 - adi,ad7091r + - rohm,bd79105 then: properties: adi,conversion-start-gpios: true @@ -161,6 +204,17 @@ allOf: properties: adi,conversion-start-gpios: false =20 + # Devices with a convstart GPIO where it is not optional + - if: + properties: + compatible: + contains: + enum: + - rohm,bd79105 + then: + required: + - adi,conversion-start-gpios + unevaluatedProperties: false =20 examples: --=20 2.50.1 --f2LLsVrY0GN/V41a Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmiVu0EACgkQeFA3/03a ocW9CAf/UPyXzdt1BynNJE7meCRzAkG9IHNcnMy/peVmH59nu/DDz/OmIONCiY/S 0xs9+Z62vmiNwMlqE4Sm0BU+s4gbwZBCrZsX7EuB0QNFx5jUIWfSTBBRsJHxhvNL B3vrIT8MGxQvplZq/ilo0uzb+HoHw8A7TkSUIRIxDDzqiuwGvZ6jLLYOGe6Stk5u V+GDA818TuPepjnSvpvkHQW3aB5d/+dBA9g+ao+wsXeCTYvOAfdWoZ71OVbBQx5J Fq2eIZFOhX8LSj9TShZoSu9QY2KdbPnrulfhseibeSzKXmKojArtaSxebpx+7voO p227+BnPPOE07QpDUReYge18sXjUyA== =phHV -----END PGP SIGNATURE----- --f2LLsVrY0GN/V41a-- From nobody Sun Dec 14 01:38:56 2025 Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) (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 99361267B9B; Fri, 8 Aug 2025 08:55:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754643358; cv=none; b=FUnwV1+8/Our0HGFvDpGpXqUXBw0ly9+d2Et/Brxvo7h/dNaSMKAUSDOCCvtSli7L5QcscrAGQy7ISuZsoHovhYxXjfBzZietQljcvRsksTIRUW6mUl9QLf7zIAnmOftQObVJDcmTcgShzqHXvHIpRxLfoL34lyqhwtT3gWeF3U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754643358; c=relaxed/simple; bh=OYg8Gx9p6ZS5BYnwQy23wsSJHrlVh0B0YEUdjS+lPRQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uM6IWjCJrKMX0qPcWftfvIsXjrnMtUkZ1Xj+GdbXQo0agqYXx1sqMXef0OQeVgmwnKvjhrrOygZD8cBwVLdh81Utvs/DxlnM63P4Yi8PvDGYmgqvcdbKpRhY8aRCAg6AuNMoUYe0MkRbsER0v3CdqaXtAfoZZ7+BvYrrxrC9jB8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=mKJanVI0; arc=none smtp.client-ip=209.85.208.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mKJanVI0" Received: by mail-lj1-f174.google.com with SMTP id 38308e7fff4ca-333a17be4e0so5179011fa.1; Fri, 08 Aug 2025 01:55:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754643354; x=1755248154; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=PIys3bAAa6pSMxUyZ671w9wq1HjPaUe9JQbuiuBDBrE=; b=mKJanVI0G+Yd8RCbvldY1jLQBWOQbobd3cqFtoSCAt2kpa5yk1WucLJN6iDvW54HKN C8FXZwmfK3WUBjvFYglftHiNW2+0ApYeojClwQMPZ9sg8T3zvLX4xHn9iOI0x3cBfX23 xYYM5aorc5JMaA2V51QPVu1Os75SktiKH6fySkHYAI42V8bkX/mQKhXnq5ab2v3wPZih /SiXNVhLUzwYgXwqmHbZEh6i90mUZM9ZJLE2HGVOBOHSgg7+M+HO1OHasiqwVNjzKjGe g0FFtGsl8IHGkahdCCbrze7d5d4Ua2GCrpHX3xFe0idozVVISKdKDvMpFDXWsMOT9V1V nTUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754643354; x=1755248154; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=PIys3bAAa6pSMxUyZ671w9wq1HjPaUe9JQbuiuBDBrE=; b=qF7nMuI6W92WUm8fr4y3pgf9YHGkbSg8wP4kvYz61lI4ZDZUut/K+rBuvW22/A7JR+ B3A5VJ+2yBhTeimSYIf/Z6STd4DApxVkNlL7UCQy6L1CCjwrF+9yZehDM3vGAbvXr0qZ 2IRzpO/o8J5tCvbi4N/ZTPw2SPZFqMFDOuVxHZzyu7RJ0dYrDuAVHSAInkJy4x8apE71 Im8V94IuiMgHEP5xM6IoSOPe9sHO7t/72KAxqKw0uMnCfj0QGopW1EHM9HyZ6jEjlk32 U1ROxat/Raaiy3HQ6dY35cEfgNsStWebPi8/hcQ+X0vlEKmj1pU+ClvWrSFL5+oZQIo8 4VOQ== X-Forwarded-Encrypted: i=1; AJvYcCUMluoyHkyhwhDFzMmhP/4QRPVeZ/CzwXQ9eaZV2lvvBPeM9c9skNt2hVKk5ioLThm8K6IjFY03bepA@vger.kernel.org, AJvYcCVaqf42JSoPSpJtW58nfo6EGZWhVQHD8N9siFqbvdzwcrrJDvFnlEmh6XGTi1Puzabo7XyiJ46Rs1lb@vger.kernel.org, AJvYcCWwNAHgMf0rVIT8T4fGMnyzOhcVjlz0Pib7ta8kMGxvsFUnjT0asLtTbQHIOCe4GUHcoIDOfoST2GyonGDk@vger.kernel.org X-Gm-Message-State: AOJu0YzQ3SRi9ERWSnhbYnp9QUHm3V9wGCfp858anSIdiptbxOYB8O0F fyzwK9Nes+WFkXgYYaxcPIncrpMLm2rIf3fTJWQpSdHaNPzAiolClg2+ X-Gm-Gg: ASbGncsHduZQw9DYrPtsoBG2BGtd++3cI6zksTt58Q+5TprIZHC8iYxZpq407L4zzWl RzvTOJv4BiM0Q0+O7xejMVnBzJk+hDxy7OrgrzLKwMwNRrsmbrvh1bvESxPoTF+Kr5E6BDGz9mG UTrjPkO2dH1L5CWCpuruCtirgJGItmRMlKzOEL2/SLADluMcIQKHBKw4127JsLI+Gh48/FBBoDv JW1s8kK/h3hNuUb4BB5pWXjrIOGtqJCuMcNDBJicujg4B13Kw/K6/8Fndqi1kFxirtoeBWWLr2i gyAaXT9poZaeJw3rSa4xk2sN2Db50/zAKCZp+cbAoWU9arMq3mylonBHa69JSNEmyPY/NKwAkoo e+njDWUo3hucXu/oO1/AN3j00EyEx X-Google-Smtp-Source: AGHT+IHd03hIZFq+mKRDRpaNgEPl4nto3IHVTcpImtQsHtoKeXN0wVAnhIUbxRIPv2p+abqnhAEVDQ== X-Received: by 2002:a05:6512:1597:b0:55a:90b:7a37 with SMTP id 2adb3069b0e04-55cc0157e86mr561404e87.50.1754643353425; Fri, 08 Aug 2025 01:55:53 -0700 (PDT) Received: from mva-rohm ([2a10:a5c0:800d:dd00:8fdf:935a:2c85:d703]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-55b88c9906dsm2953861e87.83.2025.08.08.01.55.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Aug 2025 01:55:52 -0700 (PDT) Date: Fri, 8 Aug 2025 11:55:48 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , David Lechner , Nuno =?iso-8859-1?Q?S=E1?= , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matti Vaittinen , Liam Girdwood , Mark Brown , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 09/10] iio: adc: ad7476: Support ROHM BD79105 Message-ID: <2a8c8107475f2e394c1a0a51c9a9ddc941132b5d.1754641960.git.mazziesaccount@gmail.com> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="2DFhNzDdPZ0QcWX0" Content-Disposition: inline In-Reply-To: --2DFhNzDdPZ0QcWX0 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The ROHM BD79105 is a simple 16-bit ADC accessible via SPI*. The BD79105 has a CONVSTART pin, which must be set high to start the ADC conversion. Unlike with the ad7091 and ad7091r which also have a CONVSTART pin, the BD79105 requires that the pin must remain high also for the duration of the SPI access. (*) Couple of words about the SPI. The BD79105 has pins named as CONVSTART, SCLK, DIN and DOUT. For the curious reader, DIN is not SPI MISO. DIN is a signal which can be used as a chip-select. When DIN is pulled low, the ADC will output the completed measurement via DOUT as SCLK is clocked. According to the data-sheet, the DIN can also be used for daisy-chaining multiple ADCs. Furthermore, DOUT can be used also for a 'data-ready' -IRQ. These modes aren't supported by this driver. Support reading ADC scale and data from the BD79105 using SPI, when DIN is used as a chip-select. Signed-off-by: Matti Vaittinen Reviewed-by: Andy Shevchenko Reviewed-by: Nuno S=C3=A1 --- Revision history: v2 =3D> v3: - Check for missing convstart GPIO at probe. - Use indirect call to convstart (via function pointer) also from the ad7476_scan_direct(). v1 =3D> v2: - Fix the conversion delay for the BD79105 - Drop unnecessary GPIO check from the convstart disable - Drop unintended whitespace change - Fix spelling --- drivers/iio/adc/ad7476.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c index 6cb2cbeafbd3..1bec6657394c 100644 --- a/drivers/iio/adc/ad7476.c +++ b/drivers/iio/adc/ad7476.c @@ -32,8 +32,10 @@ struct ad7476_chip_info { struct iio_chan_spec channel[2]; void (*reset)(struct ad7476_state *); void (*conversion_pre_op)(struct ad7476_state *st); + void (*conversion_post_op)(struct ad7476_state *st); bool has_vref; bool has_vdrive; + bool convstart_required; }; =20 struct ad7476_state { @@ -64,6 +66,18 @@ static void ad7091_convst(struct ad7476_state *st) udelay(1); /* Conversion time: 650 ns max */ } =20 +static void bd79105_convst_disable(struct ad7476_state *st) +{ + gpiod_set_value_cansleep(st->convst_gpio, 0); +} + +static void bd79105_convst_enable(struct ad7476_state *st) +{ + gpiod_set_value_cansleep(st->convst_gpio, 1); + /* Worst case, 2790 ns required for conversion */ + ndelay(2790); +} + static irqreturn_t ad7476_trigger_handler(int irq, void *p) { struct iio_poll_func *pf =3D p; @@ -81,6 +95,8 @@ static irqreturn_t ad7476_trigger_handler(int irq, void = *p) iio_push_to_buffers_with_ts(indio_dev, st->data, sizeof(st->data), iio_get_time_ns(indio_dev)); done: + if (st->chip_info->conversion_post_op) + st->chip_info->conversion_post_op(st); iio_trigger_notify_done(indio_dev->trig); =20 return IRQ_HANDLED; @@ -103,6 +119,9 @@ static int ad7476_scan_direct(struct ad7476_state *st) if (ret) return ret; =20 + if (st->chip_info->conversion_post_op) + st->chip_info->conversion_post_op(st); + return be16_to_cpup((__be16 *)st->data); } =20 @@ -273,6 +292,22 @@ static const struct ad7476_chip_info ltc2314_14_chip_i= nfo =3D { .has_vref =3D true, }; =20 +static const struct ad7476_chip_info bd79105_chip_info =3D { + .channel[0] =3D AD7091R_CHAN(16), + .channel[1] =3D IIO_CHAN_SOFT_TIMESTAMP(1), + /* + * The BD79105 starts ADC data conversion when the CONVSTART line is + * set HIGH. The CONVSTART must be kept HIGH until the data has been + * read from the ADC. + */ + .conversion_pre_op =3D bd79105_convst_enable, + .conversion_post_op =3D bd79105_convst_disable, + /* BD79105 won't do conversion without convstart */ + .convstart_required =3D true, + .has_vref =3D true, + .has_vdrive =3D true, +}; + static const struct iio_info ad7476_info =3D { .read_raw =3D &ad7476_read_raw, }; @@ -332,6 +367,9 @@ static int ad7476_probe(struct spi_device *spi) if (IS_ERR(st->convst_gpio)) return PTR_ERR(st->convst_gpio); =20 + if (st->chip_info->convstart_required && !st->convst_gpio) + return dev_err_probe(&spi->dev, -EINVAL, "No convstart GPIO\n"); + /* * This will never happen. Unless someone changes the channel specs * in this driver. And if someone does, without changing the loop @@ -401,6 +439,7 @@ static const struct spi_device_id ad7476_id[] =3D { { "ads7866", (kernel_ulong_t)&ads7866_chip_info }, { "ads7867", (kernel_ulong_t)&ads7867_chip_info }, { "ads7868", (kernel_ulong_t)&ads7868_chip_info }, + { "bd79105", (kernel_ulong_t)&bd79105_chip_info }, /* * The ROHM BU79100G is identical to the TI's ADS7866 from the software * point of view. The binding document mandates the ADS7866 to be --=20 2.50.1 --2DFhNzDdPZ0QcWX0 Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmiVu5QACgkQeFA3/03a ocXmzQf/dvwrVkreuDO18fqPSKtlWrr2euJL29mcRd3F6DTN+5pS/SUkBGo9PqCQ L/xeGP7CTJZxrdzKWxRaKk+0YwXxc0GejNnmTROngnLN9OSFCP37JUO7Wf5ZI3lR jgRSjx36A5sSurQZC7W3SL8hJAt5k/jrrXUJDCQsHEJcA0csLV8QY3MOLHnhBuwZ 78Knxs/uVUi92zBqLnNU0PicEXscxLduzXvyK4PUkK7iQhOEa9jwrw7xvQfQJeW8 gAn61NU7vgMSZHZmvdkFGeu16qFZZ6ceMCgB9mIqMBYsso9CFfIFn1qF0ES8j9Gt s6lwSSKrVsFibkh+i86Yi9VvC3qseQ== =Abxz -----END PGP SIGNATURE----- --2DFhNzDdPZ0QcWX0-- From nobody Sun Dec 14 01:38:56 2025 Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) (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 5DCF3266B72; Fri, 8 Aug 2025 08:56:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754643375; cv=none; b=R/ZP4+6yfWaH3gOfLQWxsyOLsdR8eD5Z3iNYR6Zv3zqpvmzyR6jYIzMNVGr8hFcOR+hXci2ho6Ern6TG511yuezJzqM0+r0Xnu23iFMkMNGdPfVl63FK8qdDYRYaYzmKhLg45NLDKUuXCULPgeqGQkZZ4vT9On7kyJNwaTmkA3M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754643375; c=relaxed/simple; bh=rFTTNR9H48DnISkyFQUW3VsEiJYCg3e1Ar2G9VaR4LY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=r/zFuVxw5pJpH90kt7f+y+36OBPTlVFR2NLrQKGjt31DHPoPJqMR39zpTYaGiIB/hdBtH027HMgcv8NPClxAgO+wBH2CFEHvevwsVHOKNcRuCuw73uT5T6TSUcHgDFl1uSb0nMGQ/QRpysx6290GB0bA6POby70SbwCt/+76Vik= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=LI5JSdwC; arc=none smtp.client-ip=209.85.208.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LI5JSdwC" Received: by mail-lj1-f179.google.com with SMTP id 38308e7fff4ca-32f1df58f21so18680471fa.3; Fri, 08 Aug 2025 01:56:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754643370; x=1755248170; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=AJGgSNIsweKWTXJAatM4tI8EyYGpipTjfGU8BW+ZG98=; b=LI5JSdwCDlBI3PyzvrSFhs7b3hQ8vLJW8ApI8nT5pxHru7kE8cDRaWgQJR6hKBszrv YLyvGO50RalqrdVT16H7DJ8jJyz0KQl4+ey7/1V5ykrDilL7PyE7FNoV3Y4Ofk6Xi6Wd 0hyJXQtEWhVW+QZFPLMB/T2sXkaruAp4/u/IzfT5pIcVSEZHFT1brWqAVIBntHX24GV7 yM1Xc1ZrVIKr9w6dL1+LokhXN1IlrfeI8g9hXcQwCQx3TD6+5GCEI0ETmwptMsTkiyWf LVc5Oi5KIT93bIwqnlIK84mHQBtpa1izTmI7lUZ2bRXSsCU50YvLECRpZElaHedqg7kf 8SFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754643370; x=1755248170; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=AJGgSNIsweKWTXJAatM4tI8EyYGpipTjfGU8BW+ZG98=; b=rTOj5D7Z37H/Q9nkiI1vKjtYzMJoBJEggaKYyIB4prQeLPirABNUhnhsU6ziKAfc/o 8Wbp1rq/Hs1V1udsR8oUNusFvFqSIPn+3m7GfDGSfEBTnVlfaPp65/URCnHAzNzvtP0g QvLK7UdFS2PFZBz7DG6vs4w27BXixAms9SnSTYCZANxqz84OkieyoyGlgGDRFGO++sT9 d8ziEGoAtJsoAowSFJMiqMrM+HVl3WW4/EPOu7BBFudcvuiimz1NpXmAYlmNN9TzG0/p 8FbfYXYlSF7GDYM8RDmCskjiZBj5NdJjZv+ru9XazUjNHst8Ri/LdH+LK1OYKloboFqw ONYQ== X-Forwarded-Encrypted: i=1; AJvYcCVEMZkIiNvh4FeNzH9u2kOB9LSYBnEHy/VTv48z/eS17+FxyCyA+VXd2PiuEVQz3yfWCSYxWB+p80r1@vger.kernel.org, AJvYcCWIFr0hupGcwG7bCeljelN1sMSs3oPPCwSLCV0vsiEi0U4BJf60Wdw4HUaJBWZAetJA+Vb0aGjQKymi7NeK@vger.kernel.org, AJvYcCWYMAJuPYEPAp1aDgqDRbm1RlbhxeVxzVLUZ+pwEoClx95elXwtef65e/O5rhWwRT9U7WSRM3/iVV40@vger.kernel.org X-Gm-Message-State: AOJu0YyxYGaXsS4DBdLyYi8w24oSdbrRA/TBJ0OCJXR9Udhov25Ydyo5 eExi3j/tUtC6MdvBK3b+sDh8pMX9uRyHoriGezjtS805XQgx6X+T+dwX X-Gm-Gg: ASbGncuAMlf4iutmKQKoCBvgOm1Z0pJbqCQts/9vSUxxUsSrtwEQFvxWwlhA7pb1eTy mHiIcFNukkWhvgqm+But78s9s422wbrD7v2i4A9SMQUgya7vjHXLytHV0Q4KcdiIkyID/IzE4Sd S8Ydqb3fmRRz6z60ZAmHgWODqmyskB7RBPHLS60fyFXBatu8G0xSPycUS/pBuX0qlJ0Seabn9sP f5fXs1E0ZkA76+nndS2/BZl28TAo5U2TsPwI0XsX71AMIPVXroC+lhZDTy+EMW2+JLHAxA5Ex+P k2uncpEsCjCFOIKTIq35XIJcN2liSnW2wC4ayUoVSwuh2NXTiLMyVYfV6hSaAmwJbywmjk/k0I0 6nu2Ldtd97YrEgkTWnZJT9TVVfmy2 X-Google-Smtp-Source: AGHT+IFfT6i8rxg9uGFLErOOPZzC0+/iMgekhVeg3vcuLBxACDh0/MxAQPSE4JM4lX8qkKIameQY6A== X-Received: by 2002:a2e:b8c2:0:b0:332:4558:b30b with SMTP id 38308e7fff4ca-333a219f377mr5800401fa.18.1754643370176; Fri, 08 Aug 2025 01:56:10 -0700 (PDT) Received: from mva-rohm ([2a10:a5c0:800d:dd00:8fdf:935a:2c85:d703]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-33238272d3fsm29654871fa.5.2025.08.08.01.56.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Aug 2025 01:56:09 -0700 (PDT) Date: Fri, 8 Aug 2025 11:56:05 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , David Lechner , Nuno =?iso-8859-1?Q?S=E1?= , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matti Vaittinen , Liam Girdwood , Mark Brown , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 10/10] MAINTAINERS: A driver for simple 1-channel SPI ADCs Message-ID: <6ae3f5fd5441059b438350df370e7741cfc4b6c4.1754641960.git.mazziesaccount@gmail.com> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Y9CW4BizsC4F2rAD" Content-Disposition: inline In-Reply-To: --Y9CW4BizsC4F2rAD Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add undersigned as a maintainer for the ad7476.c which supports a few simple 1-channel ADC connected to SPI. Signed-off-by: Matti Vaittinen Reviewed-by: Andy Shevchenko --- Revision history: v1 =3D> : - No changes. I'll try to keep this on eye. I only have access to the ROHM BD79105 and BU79100g. I would welcome anyone with access to other supported ADCs (and time, energy and the knowledge) to join me. :) --- MAINTAINERS | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index f8c8f682edf6..36fa6333f7b5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -455,6 +455,11 @@ F: Documentation/devicetree/bindings/iio/adc/adi,ad738= 0.yaml F: Documentation/iio/ad7380.rst F: drivers/iio/adc/ad7380.c =20 +AD7476 ADC DRIVER FOR VARIOUS SIMPLE 1-CHANNEL SPI ADCs +M: Matti Vaittinen +S: Maintained +F: drivers/iio/adc/ad7476.c + AD7877 TOUCHSCREEN DRIVER M: Michael Hennerich S: Supported --=20 2.50.1 --Y9CW4BizsC4F2rAD Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmiVu6UACgkQeFA3/03a ocWd6wgA0QOQsbGEVoPJkwlKTnFdNu6x+Oom9N2gNWYEqivhDYJIh7nYGZ5/e/zk W6pN1RSVoQlvVak0j4de+FMWMbVdO20bWnWJOqWZTSi5ml0xLu4fNW6aBFQJVW8a H+tOk3HIAtxzbqE3WuKKDB47qHdVLCunmBMuy4jAOqOdXdRysUtW2eicWb6jNYez WJ84tlIcn5MelMJfyLKQTHvVZfHpSSmN3ZRXABJU8EbENkxqMKji8rhIk+IK4Ldi jhRGMpOs70xKbywe7PWeFsf/4+r5AgLLctEdlIGor6fsnWrzgcNCXZFytFUY/5K7 JCnp+ss+Jpk4OKz0f7PSK6UdBI94uQ== =62nB -----END PGP SIGNATURE----- --Y9CW4BizsC4F2rAD--