From nobody Sun Dec 14 02:05:38 2025 Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) (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 466C9224896; Thu, 7 Aug 2025 09:34:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754559245; cv=none; b=AGUPma5tvxrBrg2MA6I3SvZ/nvfexf4fKnUnXtz5qPizaYu8HcVxelZ/6x/o7p5kDa3bVu5J2UoNdOee7/B8tkjlyJ7xyytj0lDR3feP4K4NPH4CjOJzF7qK73vE/ezK1iUmhmgDWpOYiP7n4hHmgEIDpu/8PHhdwBH4war5rbQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754559245; c=relaxed/simple; bh=rWnknOtL43q/mS0uhWPUP9DlEnZ/SBpnwbM84S2iMjw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ZJYS4A8/8bncyVTbYfbnp51Ctsbz8zeAJ70+NPoxuURskFaUZ1XgflVTy4OFv2upJIGIPoKdKTkZfQuLTHUrySySJ6AcCJc1gMd5odlOZYX40V0qcj5ZZilko/bFZEKAQcTf7BIArMxhIiPRqBI14tk5AEUYfwghlbjAD6oyKm8= 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=RBmxRKNT; arc=none smtp.client-ip=209.85.167.51 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="RBmxRKNT" Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-55b9375d703so789212e87.3; Thu, 07 Aug 2025 02:34:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754559241; x=1755164041; 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=ycotkfQEbTeWDd7oVq40Q4Yr0gPz9YFQgZznBnGWiFo=; b=RBmxRKNTMtGS+X2jRPI7xjTMmvbv7E+4I0E8qAqUblZeL/+tNXGeXajnZ/DSQonDWn VMAbTeFEI+JFRj/yU2qdn2x2uBM2XY+USKe3AoSY3C51ddz+yYPAroaYYeR4PsB4l3IT lLFGGFoE3cLJlGp86bIaW79OAj+aD36BZUrKetnYCnwLr8eZlRAF9AkGR/ovCVCuoKxB x8QSThdhdJ54pzCR6XwWgeY68vzBedHd8ort/vh1mfNkSu0c8pwQLCLd1ipkjfV/ImtB o+P0aLeatMCfSNCpxWSSXVdZpyhiM9lMEl7XUmrVLAYvfK9jXA5OQllPETV4y7X/2f3/ dw4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754559241; x=1755164041; 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=ycotkfQEbTeWDd7oVq40Q4Yr0gPz9YFQgZznBnGWiFo=; b=S2K5VspG34QZVeLSF75AD73P0EJDOY1NGYXhSv0fprgOGLRYKqbHTbUVM3PAE/zDWE dAopXMVgdzR9pOh5ivnHeVCMfra04MhA722QCeDn7t9SA0tZe6Gtz54NamuWQOWyxN1s 3C7yyd1E+8GapdbOp0c/QYOeqMsJoBaD8cT+SMTKTbhFQpDkqhXq1l7s42ims5kosSZb 65Tw+OCpb5WBetrRfq8vVTWI+hp1qE2vl5CkWPWRudychB0/JkgkwBkkJeq4/p+Tqdxm mgjsBVOD3WoviA0os2wpOCcCglsYSNFw7oMtSMLSG0X75SFM8VDmCKsykjuwZYyB149y SQSg== X-Forwarded-Encrypted: i=1; AJvYcCUUah+Otg6owW20iXrZITN42igXf5r2IMF0+sVwKwTz5+Tp4ESvTHe2TEumVc/mLJHjyL1U7t8oF6cs@vger.kernel.org, AJvYcCUfuvNIGGunnCHtYF+/LvQ8mH9LKgDMK5zZluQ3b6V+mLEG7mGVNFRhWzLvv0iaBrg+xtCK1x0l6eHB@vger.kernel.org, AJvYcCWgT7v6mCw9lQDwZHf0+rILwLT7Rg5aKlr2RkDISL+58Dh1zFh4UgqzL0Uy9pE5ZnepHBMC2YXKEUKD2pc9@vger.kernel.org X-Gm-Message-State: AOJu0YwuZENeb9piaxt6fNVjJcXgqVKAGONZGptn5m8VsLj+t4OPTW/g dBK8s1dKYFXimg5UnJNYKTlKyyQi3p3Gi0nhW9nQpvZHu1lrZYHVu7/b X-Gm-Gg: ASbGncsiXcQjioTj9l3O87jzbVoLe5N933NAB/oiEULU94/y76Y8Ppax4I37qpiVoHo 3YYi47j2ddH3Fjkg1511CTfYCfAdIMuaRzmWZ5KdsaSD23etWmBOMZHNlv87sBUVmkcOODTvJBv PJSxuaXFuUM5gAH4S09TQ473t3n6Dx0hayPvIyPDu8VME7xCZpZsowew0FoQZWgfbL/d0NIewlm pxb/hEE6ZoKdROMjXxmo16uL7ijtprEzOdabu6YPVIAQYf/gcVacIYrrSbyAeOl21GsSywvFdXP UUYCBN2ZLSvlpOCgapC8Djy2H3xfyGIQK1aoaV/HDrt7gAIOUgxlkPr5ceUJrge8qQ1Z4ahTyCX K5Xo1GiETHBUxbWcGc72zMprd4w8i X-Google-Smtp-Source: AGHT+IFoPL617d5O3vLjXUcoI0UlVgqOrWU8+3iDZrjgNHUAVrqNgRZ5nlQbmXnBFTeEyxLSsl+WCQ== X-Received: by 2002:a05:6512:b24:b0:55c:adae:37b2 with SMTP id 2adb3069b0e04-55caf3eac20mr1671083e87.49.1754559240901; Thu, 07 Aug 2025 02:34:00 -0700 (PDT) Received: from mva-rohm ([2a10:a5c0:800d:dd00:8fdf:935a:2c85:d703]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-55b8898c158sm2575423e87.14.2025.08.07.02.33.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Aug 2025 02:34:00 -0700 (PDT) Date: Thu, 7 Aug 2025 12:33:56 +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 v2 01/10] iio: adc: ad7476: Simplify chip type detection Message-ID: <87c72ad221c027f3cc678839c1605eaedf0e6a0d.1754559149.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="Iqt5B/khuJyPDe6R" Content-Disposition: inline In-Reply-To: --Iqt5B/khuJyPDe6R 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 --- 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 --Iqt5B/khuJyPDe6R Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmiUcwQACgkQeFA3/03a ocUdDwf/QoWkHnZDTIZLfj1/BpaE4yeir1fGLD4WIQzBJw2GrJWGvpDufxzWpXkL vuSMxELgACbdF4G2kezhL2iDZbb0GxGQOnPjiuUZ3VKvzgIlYK9FtZ8WUCQkJC4e suVth/vadDfI64HDPTL4/FQ3Y37l4Z+j7OZexQhU6IbcusmMO2AmCsZfWNNBt/fF wjwOIp1w+znK9ItImSIRwQS+/yu3FTXqMlDdg+9srumeCyT4FUZku4pVA2CQZZLA SmaK0icm3Lz2dxEEBLREQ7455xL4RwQ/k8e7aEPb8+K3wex3ZNtpvWOGr9Tw/H9B J6rNuHmr1ayEdWp+pnrBXnTQHLhoGg== =Mlvf -----END PGP SIGNATURE----- --Iqt5B/khuJyPDe6R-- From nobody Sun Dec 14 02:05:38 2025 Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) (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 57ACC245014; Thu, 7 Aug 2025 09:34:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754559256; cv=none; b=SLlSkd636BtEOQXeNC+0HcO+z2L5YlAAHdX0LZsSQY1qpw6gsG43JTZzgslFcvadMzu6Gu/No3gPNStS4GNpb4/hODANpXYMcfUjWW2cy/PUFQcC3MnWZlRJ8FVElbHLaJ1O8Gcu9h7NbczqN5P02SPN43vVVEWMo1HVs/iMgk0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754559256; c=relaxed/simple; bh=taUD5WxbSOzi90Hjdo4H+BnAwJLo+wYitJ+fAVWhbPU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=IXM1IJlxkReDDyq8CkOaW8xZrs5UMsd5ajksI/6N3ejGfS1j6/4GGt49D9Oz3oQQTWm9OdH0ceMf7UPJ1upvrK5Xct7NAjWM1NA2mq5dGEUVLEyRDquSAohY+Dvl7sTW5ofhH4cdlrhz19b7bdUmCPseRjxAEpgajp1PTTfPfb0= 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=MWyrpBTr; arc=none smtp.client-ip=209.85.167.51 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="MWyrpBTr" Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-55b9a23d633so832121e87.1; Thu, 07 Aug 2025 02:34:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754559252; x=1755164052; 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=3PHXy6cl3eFgtfYJ0Pk9tHt2y4LdPMHXj7NvHxv7R1k=; b=MWyrpBTrCVoj/WHDTRL04oKOvm5SiUC+vdtpX6mg2cdtWOmyZMlSsUTZkFXSZafYf0 CvzUhajFd5h7pJKdKh/7KpN6cQPPoU/nVEs3pGPe43orte9eOD37PXmIilRIvb6cZtfH Bejgg525G4AEr+xGI5FPJkTM0044mtOxmaRAlG60hVwTDp8f8LWga9uswEeAA0f1fHxu CAN3P9Nqi8gjt8SX+wePCyHFqoNBmctX4NiaWHzwcX8LUYajGbIVkkViRLKqq+iyg5kE 6qth+C0IqFc/yKYirIPT3OPD9P4rubq3O3HpHPxd78NsdDGaORYp1JGMCwdbGT8qyozl L27Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754559252; x=1755164052; 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=3PHXy6cl3eFgtfYJ0Pk9tHt2y4LdPMHXj7NvHxv7R1k=; b=WTwpDt0ZjPteiStMsVBXrm/I4tKxkosiHZ8H9iOsV8OgXwCqxL6HFGNSxUEVSOvaXN s0kfL442H+taVGYTLIMqgR7h6QCI0Mjw4qyShfEj+N0IUSlZQpsB1M2TWSAX2E2nmAqE bcRXoExnvHPhHQYG/rYDu80HSE6lya6MwTRLoDoV0AQr8umC6GP7Q8HfQap86pmxamGK mwsDAG8Hm64M8hmmKABc3/Hzm3VaS+5AFlvXotMFrh4uPmD2dWlbFvHbqGbjU1kmKNYO 1tgdqNT/p6tJgzUQrzi47yhNss40EiFgDnIkSKT1QQa7aLwJ8B5I8n3lHvPBpJ5P8VDn AQCA== X-Forwarded-Encrypted: i=1; AJvYcCVphqJP7xO3m9pgr1Baf4SWLrM+xAnPulHMTbxZ2jQo1BdvZohbOCB2t2HHjhPnHMhxEzTv3jA5jjFL@vger.kernel.org, AJvYcCXNy8O2x5k3o1MLLUCQBSHP/sKziGtD8rWCOxW/aoWuJ1FBbwxYtwNSoZtCec9VTOxvmZrhsq1EKK+awjkQ@vger.kernel.org, AJvYcCXy9N2nR5nUmftT7s8LRhmPQ6Gqx8CjBPGumx6uf8HtV09LbKZv4L3RPm/bFpp/4SYW0DvyhEjJSiNn@vger.kernel.org X-Gm-Message-State: AOJu0YwvnLO3jKbx2/eyqXv2FyW/+EjWD5VN57QbpubUHthBUG04Th4E 0pfz/VreXG9RnoOrjuZf2PoZRXAEioKHgzznkyKyfxdazr0y2IIcWLVR X-Gm-Gg: ASbGncuw/kvvma2X4yxUZBSBoi0DYkZZ4CoLi+21MAn9CWVMfln/nu7qDcwG9KtRR1v HncstpLybfSFtLLJe0XDHAyH1kN8KdcsQD9rgdA2b5SIHsKhYVSzMfehzECbtkV+DwhuV3aV/P5 Cc/7W85qFhaBd5HI29rkN7InFtaClkdkxUR086HnQxR2WwhvdrBEAQVeiQvrnc6K/T+rMgHQTpu tUdjcQnxk20Diy0FkVcTpB7nQA04ORGgOMZvRo2SyS3eAzGX+yo/1GIP12Pl7ZS3kjP/AcRT++R at6Yvw9j/ajYFsT6l3UuQBloCUSOwR/tMWbxxHvVyGbPtBVCKDHWKDEhfGPY9lOZD5UvmgEuND1 RYOBGREGvNp+wUhnshWhKtqmEBtHCQJMTxsmKKeU= X-Google-Smtp-Source: AGHT+IH+cVsZNQWFcKlY/YTpFPVpjWGxEEGxcui3zaLcdcDAOoSUAYyAYDNOyCJzQzKZrD7aQxMP/g== X-Received: by 2002:a05:6512:138d:b0:550:e692:611b with SMTP id 2adb3069b0e04-55cb6209e7amr900816e87.16.1754559252113; Thu, 07 Aug 2025 02:34:12 -0700 (PDT) Received: from mva-rohm ([2a10:a5c0:800d:dd00:8fdf:935a:2c85:d703]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-55b88c99057sm2562292e87.91.2025.08.07.02.34.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Aug 2025 02:34:11 -0700 (PDT) Date: Thu, 7 Aug 2025 12:34: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 v2 02/10] iio: adc: ad7476: Simplify scale handling Message-ID: <72ee22907f2bb21a820bc6080a7cb6635294d5aa.1754559149.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="5xvKAZ0hjovuugsC" Content-Disposition: inline In-Reply-To: --5xvKAZ0hjovuugsC 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 --- Revision history: 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 --5xvKAZ0hjovuugsC Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmiUcw8ACgkQeFA3/03a ocX9UQgAqICD1NQXdC5ZFoR5lUHdgn2UxZRzQxj/fzg43DF0tfQ+e1TZUa2GtdJV N4z8TNpbO61dYciR5Z/4Xj1UAokV6ChvOqRxyBuT0w32iyRtxgefErTyp6doW2WS dzI6HOwj5enGb0NljDS4z2+QWawB/N2N35UpkZO4C6Kd+YGeeLel1ZBZCa7/SlhP tGB8YqHMMzk8uSrGs/TL+Vg/FKSeX+KAqYSs+HNqh9zubKTCWmORob0tGoe4lvZM cQTRzhqwXr4QEnprsv3Xl5E5D2SXClowFkzfERmQUbM5fJp3H5lFv7JAhELnCH6M EsxXQ5nzl8A3N3nUKVd/YfJzSifccA== =7wrE -----END PGP SIGNATURE----- --5xvKAZ0hjovuugsC-- From nobody Sun Dec 14 02:05:38 2025 Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (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 34D1B24678A; Thu, 7 Aug 2025 09:34:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754559268; cv=none; b=m2ow3ShE5KWxAgciJ+zwWfcNDaPnw9LuSUFx+4nGcK41kCUcb6eoYNubWulKNctIckrDil/RgGeXuBOOGU0g+2bHygEzCb4kb75WnT/liD2TmU+zanX9Zk7QbM2CESLKWqbLexbuDkg9zc1HxWHu11aDF4yJPb8hRGDBPTAh0qA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754559268; c=relaxed/simple; bh=O2ueyr+B0ri2LzKhL1UU4mM3o5ahwf/ZvWLBsxzWzOw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=RUzgJMBoxTdLasr2Of7Xj+7GQC+AK6b2X8GQacrFL395szkDnuHIEgOLeyT8ksMnVbglhlCZPNLwM82ysKsEmynaFCXfa5aRopLwTmmUXw8wI+6y/pYWlN/8q7AZYYmUlCSSnuFYxEEq9R8ZVErdQ6tNb2Oria7Cew9bAfe3rp4= 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=keSal52J; arc=none smtp.client-ip=209.85.167.52 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="keSal52J" Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-55b8a0f36fcso898259e87.1; Thu, 07 Aug 2025 02:34:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754559264; x=1755164064; 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=Xlpz6uXwD6POSBazwUz9cwRtiqHcvTaGRwP5mmmfK3Q=; b=keSal52JuIOJ59sCa5xMaixn7MzEg1JnwZERDHVtZ+fsJ/+b35lICxETzflkG/ject RxWpTz75JhoxPId8U4IiJVvaTi6u9FxKSs9zTF8JW6bJJDza1UjQLO+RM2ZJKIgh4tv0 IQq2UrczLHT8nOcGBjRUVCc4K6Ezhnm9ttHDU2k0hOTDu09mLripLVp5YJkUyMephLog cyQvX6Z//MeGY6RSF7dh0rj+Un1YtViZqeh7LJWk7txJowJO8xo+G4Cbtmnwa+5mZriX xg+TNP34s5Oiusd86FZf0KEMtFab/ZnL41hH0RROJUb7cpEIz6Z3uZyjjGWJCgj5KpPd 2BLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754559264; x=1755164064; 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=Xlpz6uXwD6POSBazwUz9cwRtiqHcvTaGRwP5mmmfK3Q=; b=Az5Y0LPC1V9+Sb2BUH7jv3m9uzAEQCmXGgp0V0Ctabi6FfAcsbSPN7YOrSzCVVK3C/ WQP1quUuPnZ0gmnY3X4R9tDUDHFxEmhhyuh/ShZV30EFDPXBMUNyK5Mp61nxPd/zeMDR wV0Stk5huYV6+l2dJHTyiWYFjAdvzxBaQk8KmsGHYbeejfZetvLcZf8FVabSWqvRUPF7 49jNSRhg1inCjzCFNZCqUg/8kozeJoCjpm7crBqLg2iWjldtOVPrBlCNedmCqrv/831Z ue3LgkdNvxd1YUBf63ArsXagjyc2DbiTMrxTStgUZiZuh6/XUP/jkm9M0WouJpFZZ14y gMqw== X-Forwarded-Encrypted: i=1; AJvYcCUBFXCiA6WfVTEVXMSimfEYY5a7g4rsO7BICIa4KVHvmiZGKOiXlgUUQ6DwxqlW7joQToCdTtW090hP@vger.kernel.org, AJvYcCVboz/R/Wv4EueRrvjfSQXA3P3LshSS8WGjfkH6yezh9DLdY6MNjDiYbav5L7i55zzImPv2N4+lOkSP@vger.kernel.org, AJvYcCXPaN3BWk+2akVgfxkZwxsjPIR0IfWkF7Istxf7H2KUaPuh1MxuqWjHPVBt0mgSTqMmI4Cd/Ai2EqwdzEmE@vger.kernel.org X-Gm-Message-State: AOJu0YwONwdxIywDjQSNRx0mHRUZQN71BKG9hBFCnQcfndovn9X83cL5 oCoIoLnhEozQ/Vvt1WTIly+uO86XmatGg7KVzWvKcVLOrIx/9nw23kyD9zq/GQ== X-Gm-Gg: ASbGnctekcY+it8L3XdMwMyASsSAp7R7k4nAaUjGk5LOxZB5M8S00AsqFI6/b1TbXba yl6DIknXifgIB/aUOUY/k9wy8XRg8dRqBVrrnf8+vrROvjPNhZxM2Q+U8ZF6LCOmC2XUvJcr6Yc 22xbl4o9Ca5hCfXGmCGGmOgyhdxHfs4vrKxC2ANYaKJAwoC4l41eLkwH6ACVszxSVwLFmhm2DP1 eLIOKisradZjIdD1Pt8UcLYFru7jDqqB9d4LcNVca6PqJqZmSP2AMHjFvLunD3a5SRjVUrqAcbh qMHQWdjib8yOmRVSb7hNpiFiyyVojIovpDfuOxdnmmrs/SkxaU8ju+zkY1R0bk6JzwH8ZzTS8+3 KA1khY+7S3C0cyXiNvaes8Xdqh9JMZYCmVYlPfnk= X-Google-Smtp-Source: AGHT+IF2jBhRN/QpN88yMSsiMczQn9QFSobLBjIBvGKbroAeo4rz1hrnMQ/X35t7VjNAUUECYwGDfg== X-Received: by 2002:ac2:4e01:0:b0:55b:5393:bb32 with SMTP id 2adb3069b0e04-55caf37bd4cmr1673670e87.33.1754559263962; Thu, 07 Aug 2025 02:34:23 -0700 (PDT) Received: from mva-rohm ([2a10:a5c0:800d:dd00:8fdf:935a:2c85:d703]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-55b88ca6274sm2572955e87.140.2025.08.07.02.34.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Aug 2025 02:34:23 -0700 (PDT) Date: Thu, 7 Aug 2025 12:34:18 +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 v2 03/10] iio: adc: ad7476: Use mV for internal reference Message-ID: <415c4c8f8301395aee2a85d071722fd6bcb488ec.1754559149.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="6pqI/XR25oVK9acU" Content-Disposition: inline In-Reply-To: --6pqI/XR25oVK9acU 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 --- 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 --6pqI/XR25oVK9acU Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmiUcxoACgkQeFA3/03a ocUfmgf9EYHSBJjYNn3vgvqjgvC5+OK5Pk9FXEXsR9TuLF2CPpImzDs2+vHv2wkn XaMo0e/sCJthNV+QCBTWHQMTMgHAHv8G9Z+0KY2IK+KuZL8WRfmXWOJwQ/LZpJDT N/AGol4+JfGBa1yLLv3aSAEuMFoicBBlUfh6sGq9zqNPB+5bcWfaB5M6YDPnCg2J QZcMw5hyvaKS8qbNc2FlfWrVmq6d7hGQ0RT7hmdMr/yB5qFFjQ6/YrSzIlOqq59a IfkPmXC2rjTDwpxMEqhjHqTbCdn0DuK4tSX1STCunDSWlx4/lXcZdrNILjLM9LmZ /FJxbO0XEkfbVarjqojyb8MLnjvNWA== =ijm1 -----END PGP SIGNATURE----- --6pqI/XR25oVK9acU-- From nobody Sun Dec 14 02:05:38 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 507B5220F5E; Thu, 7 Aug 2025 09:34:36 +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=1754559279; cv=none; b=seyVgBJ7+r0Nks2pwU7hI0cUmyO2hpCJ9FVJQJ8gy1SsAvTQYGJBXDDCgjwxbAgYQx5LzAne7a3R9ikbKQPqXyQTaZ0BGifeylsL5EFsXvoP4SjJWBuWA2vLNthtY31iNhnXHxySyp2Mr2pHec1kkD/Y8PAACbratRWR9XIxv/A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754559279; c=relaxed/simple; bh=0vCIztPZD+BesSzci2t30zHZGAgY7hFiC7LgX3rS02o=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=KL5h7R+TO8HsauXqtxEjpmoXnboXo96DSHSC6haV97KzMoxEYmSIv0Jg1o477zTfBx0u0/UWKry5Qk1YFlwBAImRFg2SsuhMZrfD0Hvc5wccJCCkSfCOKrcPy0HfI1nHBDLFGbjA8OgQklYlrFACOAvAjlskCU/KYjI23b0FYqs= 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=KabFeLze; 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="KabFeLze" Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-555024588b1so894479e87.1; Thu, 07 Aug 2025 02:34:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754559275; x=1755164075; 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=addgU5+bNFveu8gx7RdfbotqD9xo7DZxzvISYg2VFeE=; b=KabFeLzeIODospiIzHAxZthUEIUwY1eFWUmnswejkLkwu4k3aBOiamjL1bdZfkgKqs usYWFrZyRh1bReO5rrPVpg7PzPsxmtbY7CA7a3NU/Ei7Ah9SBEptCRDArWt/DUZ5/umf 3I8dbO9jJ5zfwOKA2sPIGxlrVg6OGqiLoADlPMdlfmQgpRQbwxBcXmJNHi8RpDaBq01z 1efy+TlgGSaaIxxBnMRepoTlKvfXWPlIuYgfAFaFsk655rvsxqFz1/m2YwasUKvhn64k THZHPuPkPr8DhW4yUUpNLhF6G6cGWdYWnYg6/8mtkoKY3Nr/puYGohU2Y1uISQ25AFeO pfTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754559275; x=1755164075; 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=addgU5+bNFveu8gx7RdfbotqD9xo7DZxzvISYg2VFeE=; b=dJbPIJCoT59qFkz1qvApYWS1OuZh8i0w7StsgIvM+hTaSxDQzb6J2lbseZtfiQ373x d8RuiO2QCkX9SnqesMWDDjMuM2mwKutSAdB7Ce4IQ6VXh1uGQpMSAuFjdXgQwzpsufQG XpDUjxUV/2B784wWjgzZR7Pi9KGlWpRf9Z5FFKtvg3WIxWUU2OtNJ69bD/jVhwFGVZZ4 N9YXrjRzvGNtw5bnGPOelbxbKjTgZi8K/vkQZ52x/CMp+TBRsPiVZuToDtMMKFKik+ML exQYx7KOzJpz7sO3fvyZJUbXhQGsdi8jY7XORBIqc7CZbdieBWL9WMEXcX8sgSD7A3RK ei0Q== X-Forwarded-Encrypted: i=1; AJvYcCUeyjSxJdOk9tSLrCM9StgyHux2d3JOlZr5RzAjVRHVp7gB8i5w5ZddUzq7L/rC34Uj14drZ2kj063tpVbq@vger.kernel.org, AJvYcCUm1/ViRc3A9lQZCSb7zhCnUbq3SeMv1yo0XAB6ZJEFUZjtYLZl5PXwI9+oPtS0CSSRl1x8oEFgBHes@vger.kernel.org, AJvYcCX0AC6PWPcnrtlDgXybT7mcaZ7VIMFrODSsDXCI8s+Mtc6rPeul/LO+4vbY59jVDIjpgCQezcNP5ly0@vger.kernel.org X-Gm-Message-State: AOJu0Yz1tq674nWEB5DVOAB0SiiCtFenRrupu6ySm9D5ydsyDUwBujUb gWW1vzJq1RYMZFSvBHw4FYA9lSikmWOrUNjZOzBfuDj3iL8CdVXk0+4X X-Gm-Gg: ASbGncvk4Oclpocvh+JXfUimAHy8APUrBewQQAqetWDZcDkxsLcyeUDiRvyE0wilH65 JHy3PU71tiJu6M8cdiCVposVUI7YoBDtFtKflcr7W5sx3QFid0xQDrKSh6/fEbzvxT03vdCwpXE SnCpw5BO/oPlDttQIBUB203szlg8lbjDG5C/lbf0tWRq2kNXfUUbXhjk2dkBikVqZIcM4KZYP4l IXDIlifvrZIONNRFVV7LLgOBIFTxBOYjWgUUQBGnDUCwLBqWRATjbGVQX5q74pW7y75SjQ8fYkq iL4FQUOFKgZT2Z0x24TbMNHxcxTLA93P3JmsXLpklo8oz6Pn7yYnfmvGQzR3eSrfOuSxMzBkP7W 7CQhj/Vn9C87buGHhSnXfe6c3n+tH X-Google-Smtp-Source: AGHT+IFVKMRLKU6d7beKECE+fUIy7Z0miFvbxfdxYF+dopbKIl3zZxeB9uMWB+FLrqjBQ2Q3P6/tfA== X-Received: by 2002:a05:6512:e99:b0:55b:5b33:bc09 with SMTP id 2adb3069b0e04-55caf5f3ed9mr1798960e87.28.1754559275079; Thu, 07 Aug 2025 02:34:35 -0700 (PDT) Received: from mva-rohm ([2a10:a5c0:800d:dd00:8fdf:935a:2c85:d703]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-55cac6a3e06sm626646e87.172.2025.08.07.02.34.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Aug 2025 02:34:34 -0700 (PDT) Date: Thu, 7 Aug 2025 12:34:30 +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 v2 04/10] iio: adc: ad7476: Use correct channel for bit info Message-ID: <3d3ccb9195271c8c0cf4b476a10b81fe309d3564.1754559149.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="uvmQgl2tyCPpRLdJ" Content-Disposition: inline In-Reply-To: --uvmQgl2tyCPpRLdJ 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 --- 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 --uvmQgl2tyCPpRLdJ Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmiUcyYACgkQeFA3/03a ocX9UggAtce/kkLmUPgbx1P/Peqh1yCesHSorqLGfQdCQUfKQpEMT7QcwHPFmxkc n0j1vHNgWW/1bHdIhliJtApKS8JrLt8w7Ivsl2BPnzTIiolNiMFVFla6cYa29oJ+ /vg5olH2briUQd2U1NguGof1HvyqXNsZWnRBeN2QWniabl7npb8elU+39no02bTH SGvIXmrcPGt1Xr6/V/0fhJZ+Om0qk0BjS3C4dxY8vT7ZPkU+OOoIJDioRbx1Unwl fiTTegAkPJnjDwkGXlIP8BpHzICq/y8QxzoSataGFMUZA9tlSq47XqvH6ULlbXZP dzVaN3SHq/EZ8f5gSFTodBw798c5Kw== =+Jui -----END PGP SIGNATURE----- --uvmQgl2tyCPpRLdJ-- From nobody Sun Dec 14 02:05:38 2025 Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 61185269B01; Thu, 7 Aug 2025 09:34:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754559290; cv=none; b=ShQdCSHYg2mmc22PoeScXtpovlWo70mUhs3VK4E0Bt/EoPPFPWOpdy6YR+HeSrVGOvthb0DbCAUbF58c1oYuSxQb6yiuJWmYlvzXkmQwapGKy8aY3N2WxyD7OUCG8dREXjOW0whEVqrlMjNoivbXxV2SRZBcotfcGagDFvHAzUc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754559290; c=relaxed/simple; bh=qPsfKAkOdwlhmMMYBpBVCtzg2cdLQVNNlgpnEcJ2Xrc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=HmxWLD40bSgPI20VsY47jcvorTLsuwYXP+oWP8lnmjottxxvWUnxA/fBek32KKslAygiWAHywcgkGuBnukerRfTlQ176mA2SoGqhZI9j9AL26PxKbOfwNeKWJLv2gfADwcphr8C7RhFDX/0/H+iMYBZuF5kcZCNtsSl4XPKivFE= 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=nccU0hpY; arc=none smtp.client-ip=209.85.167.46 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="nccU0hpY" Received: by mail-lf1-f46.google.com with SMTP id 2adb3069b0e04-55b733911b3so809425e87.2; Thu, 07 Aug 2025 02:34:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754559286; x=1755164086; 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=dEdCWZIEU9/qClM35NNTpEudJXJlEAKAMyhURC1S95w=; b=nccU0hpYl56J9OifH0ZiJOGpyb2vemHv1wu4CpUj4HFWj85PEMMCeOIti07uWAfQ1o TaTI/Qk63HsSHW5IzeP2IJu7HOMSQ0nBO391EfPTnDzlQajgwphJ3s7PBq5SIA/WcJFW gL2qFhctpvRPmFHM3WukYWKa9p0cDHlDXw+O7wdEZw6nc0wD89OYw4s0wVGGJP14aLnJ J15SSjSlijCXqTWYeiUnyqTJux8Irr2g7TNdeR49SoOIHGfzj3c3Eh53/01gkJrd5mUg WRZOLqH2ggtpnod5Hb+bNl6SQpzXSp0lkIG/IK5695F7j7FMgqyq1vhrqNQgWYyALjdt 2JrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754559286; x=1755164086; 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=dEdCWZIEU9/qClM35NNTpEudJXJlEAKAMyhURC1S95w=; b=xIJ417k8x1CRwQiLBzMflATgqcIqvIL6Q1BVkrPrX1AM3+t+hEL6V3rkLZuapDBwQN NV+qFDeiRhb/CeUNhxNZWsHHkJ0/3fngSY/BKrlLbltFyRNXGQHpojDrHK68uVirJxAg TdMlR7Xdu4MqVSFEeZ4p+YgdLe5Z57M7Sp4si1ycLPC0BuZx3oP6wWBtjVEEpbo4oxBH auVBW/nHSN4MMx3VwYw9sVapyroZnkMlPHKX+a6/kIwoaher29qmmpW/Ln1+bfOB3Qzy aac66l5S7Y9ftSLiDU/vMGUq00lbOxzlglIe6u+V6nVH7hghQ7g3Hq6rZaQPYPGgzwD7 UjYw== X-Forwarded-Encrypted: i=1; AJvYcCVH2SW4Bs85Gc1N9xJ3S/x5VFtmT0YPDcfoIsz1m+Yg+sl5c7nw6z+eLoDvdAhg3CPDTK/hunf1rC+yGGe8@vger.kernel.org, AJvYcCVa2aFWuw12z43PQbSYAkHB+XCnqWuao1P00NPQ6hDZvmp4h3TQI2Tkn3RlWYMuhmGJQC2CItJ1v83R@vger.kernel.org, AJvYcCWPJ/Y9qQI+/5OWuaOnPYseZ42+7HRDjo+ifbLjzVYoAWgMk+0aaQvdidPAgr0aVMilJgRzZamvRjPb@vger.kernel.org X-Gm-Message-State: AOJu0YwdvGHVe2XZISd2k3RtWdb0wsk0Afn9O17SuQqck8qOX3EX0SHk a3XskOY4L7mL8lxb/C57d/MJOHvXaHoD7rOEi52kcnY4MnUiR1r4QuPh X-Gm-Gg: ASbGncsjpU3/i0a3wlGDg6YSkkK3KMiPZRR0dxlZreBxZpDiqXuWq218zMKshvWkNZY JSBS6UUzV3YcuSKjIj3ZSV+mIp2MiSdMLAhfzoTdZqA+KYlNA9/dksMCHzDU2/CMGDkAtQEiagL YYojB0xHI9KlTQF1jyfLvO3WJivi/5nCFouKGGZTIh3Vf0jlHvzmq+4CGDH7ZAz76FZg07aYCLV 6SKCO9OmFMQl5iD+hFDEAiXaUMGJSjt2K7aVXl/zJ+Y30nwTNpzVYi2dADmUa9e1K5QK4C+yS75 jdJytjybFRnXvk8LfhrQpMuBAMaKcdo/eFzvp9WVZ5CvEl6tF8IvIJZgoe6ehQ6hSjv42/W2Tlp hir5lnIjycCj70C93kXqVRAUs5DBu X-Google-Smtp-Source: AGHT+IGQDjOJ3EWcCO3jjdJTeflvMlvbULMrCmzMM71regQzvLzMOZoVRkX+hCBRm6SWEm3UfTX4bA== X-Received: by 2002:ac2:4bc1:0:b0:55b:914c:d0dd with SMTP id 2adb3069b0e04-55caf30641emr2157315e87.23.1754559286168; Thu, 07 Aug 2025 02:34:46 -0700 (PDT) Received: from mva-rohm ([2a10:a5c0:800d:dd00:8fdf:935a:2c85:d703]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-55b9f90f0c6sm1567613e87.7.2025.08.07.02.34.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Aug 2025 02:34:45 -0700 (PDT) Date: Thu, 7 Aug 2025 12:34:41 +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 v2 05/10] iio: adc: ad7476: Limit the scope of the chip_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="nA78UKiSkG7Cylmn" Content-Disposition: inline In-Reply-To: --nA78UKiSkG7Cylmn Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The chip_info structure is not required to be accessed after probe. Remove the chip_info pointer from the driver data to reduce the scope and to make driver clearer. Signed-off-by: Matti Vaittinen --- Revision history: v1 =3D> v2: - New patch --- drivers/iio/adc/ad7476.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c index fc701267358e..e97742912b8e 100644 --- a/drivers/iio/adc/ad7476.c +++ b/drivers/iio/adc/ad7476.c @@ -38,7 +38,6 @@ struct ad7476_chip_info { =20 struct ad7476_state { struct spi_device *spi; - const struct ad7476_chip_info *chip_info; struct gpio_desc *convst_gpio; struct spi_transfer xfer; struct spi_message msg; @@ -280,6 +279,7 @@ static const struct iio_info ad7476_info =3D { =20 static int ad7476_probe(struct spi_device *spi) { + const struct ad7476_chip_info *chip_info; struct ad7476_state *st; struct iio_dev *indio_dev; int ret; @@ -290,12 +290,12 @@ static int ad7476_probe(struct spi_device *spi) =20 st =3D iio_priv(indio_dev); =20 - st->chip_info =3D spi_get_device_match_data(spi); - if (!st->chip_info) + chip_info =3D spi_get_device_match_data(spi); + if (!chip_info) return -ENODEV; =20 /* Use VCC for reference voltage if vref / internal vref aren't used */ - if (!st->chip_info->int_vref_mv && !st->chip_info->has_vref) { + if (!chip_info->int_vref_mv && !chip_info->has_vref) { ret =3D devm_regulator_get_enable_read_voltage(&spi->dev, "vcc"); if (ret < 0) return ret; @@ -306,11 +306,11 @@ static int ad7476_probe(struct spi_device *spi) return ret; } =20 - if (st->chip_info->has_vref) { + if (chip_info->has_vref) { 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_mv || ret !=3D -ENODEV) + if (!chip_info->int_vref_mv || ret !=3D -ENODEV) return ret; } else { st->scale_mv =3D ret / 1000; @@ -318,9 +318,9 @@ static int ad7476_probe(struct spi_device *spi) } =20 if (!st->scale_mv) - st->scale_mv =3D st->chip_info->int_vref_mv; + st->scale_mv =3D chip_info->int_vref_mv; =20 - if (st->chip_info->has_vdrive) { + if (chip_info->has_vdrive) { ret =3D devm_regulator_get_enable(&spi->dev, "vdrive"); if (ret) return ret; @@ -336,12 +336,12 @@ static int ad7476_probe(struct spi_device *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->channels =3D chip_info->channel; indio_dev->num_channels =3D 2; indio_dev->info =3D &ad7476_info; =20 if (st->convst_gpio) - indio_dev->channels =3D st->chip_info->convst_channel; + indio_dev->channels =3D chip_info->convst_channel; /* Setup default message */ =20 st->xfer.rx_buf =3D &st->data; @@ -355,8 +355,8 @@ static int ad7476_probe(struct spi_device *spi) if (ret) return ret; =20 - if (st->chip_info->reset) - st->chip_info->reset(st); + if (chip_info->reset) + chip_info->reset(st); =20 return devm_iio_device_register(&spi->dev, indio_dev); } --=20 2.50.1 --nA78UKiSkG7Cylmn Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmiUczEACgkQeFA3/03a ocU2tgf/Q41tk43emXzWe6VTVSoKP6nwCxzHyfNZ2q18U0UH2cN4R8lUT5OxRW37 rLfebnEmLh+Jf2KXNkxttP3v8QNjJcbWWTMpa2f4HVb606Y+046ujtI2tZ+HaJby wPnmB3lTTmTW5Zc35tO58mzf701zPhF0vgET1rMXwIVvOcewSLKdIqoJPc85rDlI 3wLatm87rB/scUoMdaTj8zUlFcDsvLFe/YFHFKUUDCz1e/3vAiRylHS7pl+nqT4j l6EuBLuQL8cduTfLvj1YseLGK23/FRIdmstas1c6H8H9sAxM2qNtNgd/6loTGiUw 0jLa7FfuXftLUBQN/1Lu8HdZ3Akp3w== =qLDy -----END PGP SIGNATURE----- --nA78UKiSkG7Cylmn-- From nobody Sun Dec 14 02:05:38 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 6433E2609D4; Thu, 7 Aug 2025 09:34:59 +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=1754559301; cv=none; b=btW+XJxoZ2M6TV5Af/U5nzlR6PrEmfFJRZmEECBIFgQ/PDcEpHaEhUe21qmssS82Ny6d3lH6VFOe9jsz7uKOC3XcOEswO07bsHw5gSruV1/oakzkajQUbKTs62LuBgujDnd/sO1zglP1P40M26lM7XkKGc3tIogv0JFCM7bkv1s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754559301; c=relaxed/simple; bh=KQZ6ovOmuImtp+CBBb7QEeca0yE11Mi6Ia56+2Qfk/E=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WI6N2k+6lZBCEmIT53saJgGXUXqdDcUAXu1V9S6bqlgdKNMy+Tcj6wg3rRRzUXRPn+ySxAyeziKW2fQY/GtH6fxj7dcQE/vz09aryi2f4Qm7vkzphl5svhRNViUIO6qiAFgGajTPxJf/kai7PKBtBDQ8jLrz8Dx219kIkFw9NHc= 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=kMfYh85Z; 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="kMfYh85Z" Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-33275f235ffso17007381fa.0; Thu, 07 Aug 2025 02:34:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754559297; x=1755164097; 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=8fKfv0Nkf2vBcw+8Jy+gZgUsJIuuiqMC+PcsITHGfZw=; b=kMfYh85Z4/P74u/PxavE+FGgUmp44UgOUzPETYLVjLCk5ShkrUXKfwD1KKtLQhO72h 69fIuWwNrs6ShOv5nIlWIScM4yI7u19lJYHwhnxzsGJS+NL9gT25WmViJWhc4xXeHmCB bbCkbFZl1tZe39nkdJJEtQ7v9/s+nh3h+fbqBCLh3pVMmnWg2EfNFavhYXc7Ek+Kj1IC OHO/CTXuB3EhqUK7f9dYG89rL6otxDIKaMq0GwWsyFD529X9bR80Kc5ZA6oWLkCVkSc7 go0/5yyPeDJacMQseM2cSh7fJFQ5HsFWLNR7MMOn70Dm/AIH76vzvEmSCj9he/2/AJ71 gQHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754559297; x=1755164097; 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=8fKfv0Nkf2vBcw+8Jy+gZgUsJIuuiqMC+PcsITHGfZw=; b=kdDK5m6uDeAvBPI/JATDwPcf7Wq6eCwnNdeeVZ0r2UMUZCBBQwW5Z2Mtlj6/nqT31k hM1TgIYsaQ8/O8lRZmtzLZExtoZG+XTu8Wfy5UIShX6u3UazF3I1E2rR0oGOdvePCltO EIHBEog9lh0A/yJ58Na86kZfrEq94tu5kg4/yj04yIGpBCOOPBNE8sjve4KZ42LLpvLU V4k4EkFCkaCZNtl7tINbaGfKUdZeYBO2qD8HTy33eZMPUmX2yOos3CIX7ydCoMPjae5h DkY3r5bUXWha5o3dZMKqNdNfX4xG/akBLED3QutEO3ZzJXbQHt7cNnG18+Rm4YBSKMKE rHRg== X-Forwarded-Encrypted: i=1; AJvYcCUpm3odB7IDmYpz3Zzd5NsfmUUcOTSI81N6SN8W4w0tTZnaJrx2sPQdVC2UgLmWSrqek+zrLEHihrqNY67R@vger.kernel.org, AJvYcCVcaUB9ODFLYttJU9ANT04+1lBSO/tAsIbJXNnzEsLLZHoJ4wTCVcztJnzqXvNNak5r6KM4xLnsIUjG@vger.kernel.org, AJvYcCX1CfE54fkhGGAGHo2C58vOXOxBHuqp/Ipv3zOZkQhv77Tz64g6cbR98HsgmZiPXona0nuhe2+5Y9Uj@vger.kernel.org X-Gm-Message-State: AOJu0YzwQ+HO4iQAYTYSklSO9k84l5TuuVP1GUbTMx5qNijeQuzeUm2Y Ar8cZkF7yLY+ZfmI6M6gaWpmlJgRfx6qvSx2NSdQUWXicAJOReUtng1YIVYoEg== X-Gm-Gg: ASbGncsxc0A23hual1kVCIEXtwXio+OzXn6gpaTY5cSvNL7AQpjOYsUEnjzaslrZR9I xTqApmgZhCqzKfFRrcIg9dfKsy4mPSn1f4lSRX+1u7uF7gQL28ONcd76x6e0yZ/48iQEKPB8eSV jOv29vl9pev9UMGCZ/EE5UQY+H0QvjqXVBeCjXoPqcNR9++ZxK0/LmbH5J3Ovwshlbx5nXzm+NO QeFdVXFVZlAxCrWnAL4piObLtFv44TeMJmonqzoz0TcI8MxoxbjPL3NmBegJqMv694ELCUFvbpQ xMrMGLogvfCdosIsNR3XJmsS86+tglO52U1eiJh1FbcbMolcbDGpplMFDroumg3YCwAYiKHNELy lG5zdhobM5hhDmnZsf5Djoy9XmghV X-Google-Smtp-Source: AGHT+IHDJdJiUEu8Ar2bRub8FD3qZLUdU1BCkHGvq/qIWqK0EV8YDRR84YS96pGx9/VFq6qlOPTwmg== X-Received: by 2002:a2e:b893:0:b0:332:13d4:6f6e with SMTP id 38308e7fff4ca-3338d124fd2mr8411851fa.2.1754559297066; Thu, 07 Aug 2025 02:34:57 -0700 (PDT) Received: from mva-rohm ([2a10:a5c0:800d:dd00:8fdf:935a:2c85:d703]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-3323893c626sm28197591fa.79.2025.08.07.02.34.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Aug 2025 02:34:56 -0700 (PDT) Date: Thu, 7 Aug 2025 12:34:52 +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 v2 06/10] iio: adc: ad7476: Drop convstart chan_spec Message-ID: <09bf5e7973c37413ada950741e6e09c375e37c57.1754559149.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="bPRF+FJQWs6abA7X" Content-Disposition: inline In-Reply-To: --bPRF+FJQWs6abA7X 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 an 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 chan spec for each driver instance. Signed-off-by: Matti Vaittinen --- Revision history: v1 =3D> v2: - New patch I considered squashing this change with the one limiting the chip_info scope. Having this as a separate change should help reverting if someone complains about the increased memory consumption though. --- drivers/iio/adc/ad7476.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c index e97742912b8e..a30eb016c11c 100644 --- a/drivers/iio/adc/ad7476.c +++ b/drivers/iio/adc/ad7476.c @@ -29,8 +29,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; @@ -41,6 +39,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 @@ -153,24 +152,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,7 +275,7 @@ static int ad7476_probe(struct spi_device *spi) const struct ad7476_chip_info *chip_info; struct ad7476_state *st; struct iio_dev *indio_dev; - int ret; + int ret, i; =20 indio_dev =3D devm_iio_device_alloc(&spi->dev, sizeof(*st)); if (!indio_dev) @@ -332,16 +325,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 realize. 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. + */ + BUILD_BUG_ON(ARRAY_SIZE(st->channel) !=3D ARRAY_SIZE(chip_info->channel)); + for (i =3D 0; i < ARRAY_SIZE(st->channel); i++) { + st->channel[i] =3D chip_info->channel[i]; + if (st->convst_gpio) + st->channel[i].info_mask_separate |=3D + BIT(IIO_CHAN_INFO_RAW); + } + 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 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 chip_info->convst_channel; /* Setup default message */ =20 st->xfer.rx_buf =3D &st->data; --=20 2.50.1 --bPRF+FJQWs6abA7X Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmiUczwACgkQeFA3/03a ocVTbwgAhrHR8JRotB74Lfxu9MNuH5TaC9uKDmd/toJz36TfJ0WidNLw204vYdzE qTT7StYqLqzoKYzi5GI03vN14TKBQ89YC3ZgkKx3PHk0XnZtgRP8Ny2hbay8dKsK 4uxr3DQ4LDYnK3DIxyHEbF9DVVvtqJ6QR2RI1lxJezzHyLTWTeU/LEVXJz294I21 3AGCA0ruRpx3SaUImzn8/wTEDtvVDS2A02mLdf7Ng4pTGV/4Vja9X6v842BX1Q1d 6aIbC3KdEZwgoSKMMmgfJWBu6s53/U5XMbDcDdMgEcrRsp2gqrlQ/DULv3on6HzA v523f86SszKuNjO8tiF7Ri6CPhcgNw== =/WKm -----END PGP SIGNATURE----- --bPRF+FJQWs6abA7X-- From nobody Sun Dec 14 02:05:38 2025 Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (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 7A73A25392C; Thu, 7 Aug 2025 09:35:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754559313; cv=none; b=OXR1JV07yjOXKz0cx46I4KjzgSFBiKdVdAQ4D60/JJjn1P+m8ewSrk0C0T8Ytg6HZR7qzMbGG3Y9AowmHXPr8D25IBfJlOTQWFgf0UN1CUUXZK1FcWMVE9Gz0+3Nm54wdkKOiLrLrLcvN7GWxiX5Lv+P/3vIB1S5jSi8tetZLkk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754559313; c=relaxed/simple; bh=l+woFtL1W7/UzA7zPRs3KeK7rXLUBLmGdQYdEXWQeZc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=TD5w7bQBdSI5nmBJHn6OJwm/wxOuokve1tSCYYJpPYFzoTVgOfxrmWl/PS3qEXf9TtchHJRF0h0/wwKTJJeYdYk6XqdHXLmDF+rE0t7uHj54bnXmfZTT1fw08ic+9TM8Wq4ykyCeFfpoBxudtp+EaIfo1D3hAGnqDLXhDYCFoAk= 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=HM81ylys; arc=none smtp.client-ip=209.85.167.42 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="HM81ylys" Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-55b8a7a505cso1064922e87.0; Thu, 07 Aug 2025 02:35:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754559308; x=1755164108; 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=3EUsBasMFAOAbCJ1sYS53/ushup2issIIHtvCrEMH0Y=; b=HM81ylyszBS8cvQ0voBhoB/xJVB+nkh+Y5oOeK2O6tDMhP7hKOWcqD39CLK7Z4bkMA 9punGhQ+/2VcSq7KjZR+Fqhugni4AphzLPXbCcBYutKp5QX0gPb8U33wY5SqqhoQcAhM vrzEjzQZbWiAcu70rDa1S5JOc0z3MXui0lqMiuPVJ1jVrlVONxlIpDagNXywdqX+Srth mj3bk1xJjVV5NJf/rWy8G1ABHxrMCT9OtFk21qKn8XCKHvOQOzfzzEVN5W8ZCXeeTQr/ wL1Y7tJq+KssxbtSwhPxwNMOKO++dt+A7QfVLi7DT1mR2wkKyyS0syrzpUpVsJd8vgIp vZHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754559308; x=1755164108; 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=3EUsBasMFAOAbCJ1sYS53/ushup2issIIHtvCrEMH0Y=; b=hKq28lDPSN9bpbcKwO0cYfPylHbP2lSAnvNUNyFGrYNogwdunGukgGoU3zcqfyR5IY W0yAkn4O9TPZsNu0iUqK4Wyl6G7JayytDGo/ciWsqFU9TF/vLfJRl2Dcs8vZopbcuafb GjiFOB8keuD0Puw9MAQZKYtjQVA6igGoJavJuuL6kPoJT5/ZYx7yR6pk65cu9+akgPyc T6iPSPc4DH1sQ/0Nl/hRWPCosrQfoZRMCl8Cr8xkj5/LbH2rt2zTRNZEShz/5Ff3ut8E jNB+4dPFkvpgG0ihnDEOAzfkTP16F1ncR43ixfGth5E5TdaZf+GthabuZSNfjUlRd7pd OPhw== X-Forwarded-Encrypted: i=1; AJvYcCUlpp7WAbES1iow7FHer17c95MSJxMIF8NQacPmHWVG1JFLZSebmO/y4DDM27yQNbT1EGAW24O0LKCp@vger.kernel.org, AJvYcCV5VKzLq2VLMxin6zTRdLZWXkqp32xKibUSCKbHr/v3pzlTyrKLLzF2KUNxdpEkoZdR7FV+dtipAhWa@vger.kernel.org, AJvYcCVoXh14PHM4kDYp5eWJWuCK7earlAAYTQ1hNYDhMXTNu1tn+MAGyzLCzXjiAiFiXkMvOeaVcEOeNKi8lswB@vger.kernel.org X-Gm-Message-State: AOJu0YwXKriBRn/mf0QMnoCiPN2exR4U6IRl1s+Ef9+UMDS+pCt6u11T m44qBgBaRKgcTTBVhCILP5tqXPJaoSphP88aUiQsFfznpYxcUzHSgsRZ X-Gm-Gg: ASbGncsm2uN1dIZCejLlq85zfqg/dMQwcQIhYPgQc4gfgPQxH5j0olKM6RK7qhCNvg5 oIZwevXdGTNq+GY3Y/+KQIwPZzzWHSKX9CReZdvq1O7eqaXnKp9YJCBEaW6XIhuYURISHeCA8YE lQ/KhnKzm0oKpwdhLiSpzasU471hJsgmt7Lnp3bWgKow77urmO6PCXyAsgspkJW3BqBmIav6uXH ACv/yLKaAAUDLoJz7iYfiz9Ac+1hQTcIF3zu8eS+cPN9mkzWlRqymxVo8RHyhHwA+WcjhCqIrLG OG2CRDRiC+nBsB41ULHkXjtgc9xdVZwX1DKxWNYJVStAAheSaPMdUPAACdS5sLuZX1uac+jniX+ sX1Ci7n6K9Yj4P+0XABkaRLjSHgE+ X-Google-Smtp-Source: AGHT+IHcHEgrIpvotg6381CRbJkhNqRvVe34a04NOFVw750G1c1wOB9+foZNqZMejeG0h49y5VLsRA== X-Received: by 2002:a05:6512:3b07:b0:553:252f:aded with SMTP id 2adb3069b0e04-55caf517dd6mr2010470e87.6.1754559308225; Thu, 07 Aug 2025 02:35:08 -0700 (PDT) Received: from mva-rohm ([2a10:a5c0:800d:dd00:8fdf:935a:2c85:d703]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-55b88ca3fb1sm2599853e87.136.2025.08.07.02.35.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Aug 2025 02:35:07 -0700 (PDT) Date: Thu, 7 Aug 2025 12:35:03 +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 v2 07/10] iio: adc: ad7476: Conditionally call convstart 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="wHHcPTbMuBFq7jW5" Content-Disposition: inline In-Reply-To: --wHHcPTbMuBFq7jW5 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 --- Revision history: 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 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c index a30eb016c11c..8914861802be 100644 --- a/drivers/iio/adc/ad7476.c +++ b/drivers/iio/adc/ad7476.c @@ -30,6 +30,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; }; @@ -37,6 +38,7 @@ struct ad7476_chip_info { struct ad7476_state { struct spi_device *spi; struct gpio_desc *convst_gpio; + void (*conversion_pre_op)(struct ad7476_state *st); struct spi_transfer xfer; struct spi_message msg; struct iio_chan_spec channel[2]; @@ -68,7 +70,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->conversion_pre_op) + st->conversion_pre_op(st); =20 b_sent =3D spi_sync(st->spi, &st->msg); if (b_sent < 0) @@ -158,12 +161,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, @@ -319,6 +324,7 @@ static int ad7476_probe(struct spi_device *spi) return ret; } =20 + st->conversion_pre_op =3D chip_info->conversion_pre_op; st->convst_gpio =3D devm_gpiod_get_optional(&spi->dev, "adi,conversion-start", GPIOD_OUT_LOW); --=20 2.50.1 --wHHcPTbMuBFq7jW5 Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmiUc0cACgkQeFA3/03a ocXCoAf/XHp3S0MqqKrZEKJOs6gVkUhEQTiQ2UVMqyhWf8kHnXctWt3AU1nsxglu CxQ4rREWA9I82IbFZNfQKBLPKnKamaAOPwiL/xreXWw44E6RsZrxp+CE0c2/zWxS A8F1+RuPGGn0r1mfU0ZgwTnRx6QYxfshEMhZ/U5xoY2sFEvNIMEixWqPqLysKeIX PJwM4htoJ7XJe/nnJiTXWPxEC4XkUyIokFjxpEF5wD8ARS7jYP95Muw1h9eCPfTS 5fMKtl0jCplrO6BUJcO30sFMnaUmqZ1bT6ePhZR4xehqdbMUufih0F0BN7nakQl0 ik4sx+uUXlXjvWzLcwNdb4pNA9TeQQ== =RWSm -----END PGP SIGNATURE----- --wHHcPTbMuBFq7jW5-- From nobody Sun Dec 14 02:05:38 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 4E94226E17D; Thu, 7 Aug 2025 09:35:20 +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=1754559323; cv=none; b=YpY+mq4+tBMq/HoOjqxCwXm9169BADxC5O9ilW7TOeKqlg+5ZST9CZCwaC2zLcCxT0RMBA3MIgb8kkJubS9oTLxVNzTVZPWm9TaSMQ2kLRWGZoKogMwoyeGLBJqMEoEclFqIfHJt8PfgLnF1Yi4hqd5+L/Ls9K9AkS6ih89S1LI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754559323; c=relaxed/simple; bh=WUneGp4dtEsWDnOkFFAGx2PzmZNciVfF21HyZnrsDgA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=P/vCifkNY6BRMnNV9h9iNuIfW7PVpd9tcf6xIFuZKSyYkoiYY5Z66EPk5Q3uLTIktXaQUJxu1kpLy00QruT35KLFwYiSvBpgh/5BP3scv28apzuTM3jd1i+NGiTlQy6hPXx1cW0yUMI2G0w4Eub+MYsutNO+DfNGBRhzWSTCrm8= 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=ehB31vRL; 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="ehB31vRL" Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-55b859545c3so2331837e87.0; Thu, 07 Aug 2025 02:35:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754559319; x=1755164119; 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=/86h0FQRVpfowRTytjXX+T6FZ3yXmtaLRCQm9RvuMhI=; b=ehB31vRLzIzIVEOheO0S3aMpXnxG0OTN71Tf9B7u/kSI1yNXpLIMgG5bsnHHha3Udh ncOfejAdVpB0FndfJN58WAk8P6dhb2xs7eYQ/2V9NAsEPEFo6wS3SesKQ26JUlT+60MY FvwsUbh5dGJzFveM87jdu2Bm/K/hBZ4TquP0HG7K5tOP/T5DwPuQaw6z5c/Mo4WQghJC oZmTjMamLcacIlSBa9MSU7n58o+zYa4WUhwBdLvo5IbS99ohtxuFK1GfDjWRqPQarB1y U81NpXuEkZGlm3g/NViwZG5YaeNTyC6MsRLdDVdWm+JCw2T95ke7IQI6TN0BKx+lcGnJ 5tYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754559319; x=1755164119; 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=/86h0FQRVpfowRTytjXX+T6FZ3yXmtaLRCQm9RvuMhI=; b=i9cErgJZvlaQ73JlCHbksAmlbgVX4RBeNJXHzSX40wTIKKZF6kl3mYF5mxvrzFLnR0 quZplQ3JzDeOqCR6owvB4vgXcLG9VHa2X4+Y/iBTsJhDrnegh4pOpkIAmpayNUYDddeD RTKbAOCFjW2dWNxcryGoTyQXQxDm3fBJUANDUOX2PcHQvDxkEIYN9wkf8UkAuZSe2bw4 RxidYaXl9iblRFB9uWO/BcJ5ZsTH3WVl+E8qcB2HGwQbi7qTWyJz1QIo9FVnP/6vS73y KxHt/8EJ8nN6ELQMXH8wRMzM1b/hIPKnyj3c1X6NRH1CbHiM02WpUx4hSe37Ihc1Cs/5 mkmA== X-Forwarded-Encrypted: i=1; AJvYcCV1vDJP8vSwREjsL76++RWSb9VLCrm3H2QB/mPOmwgEO4DaFmg83d7sJe/iOSNGVe+aFEerLuM4py/N@vger.kernel.org, AJvYcCVegeEbXBc/w9CpiQBuxKamn2+3HNpU35ItMa0SYntcPkaBS05vh58lb69o+6TE1fi7PDLU6fscJxaK+erk@vger.kernel.org, AJvYcCXrOp/+mr4xXPVcCdt0fDCnCl/P962uy87CfYqgR6DIrrtjMT+dWTyCH+5JO2gVtU4SiEW7gjU9tJ61@vger.kernel.org X-Gm-Message-State: AOJu0YwULAi8qz9eKs3VXW9jpR2ADQAuU4dqyghuVpGwzAob2FPhn4SB eSnSn3625akS6brI/Jw2JgSC45ItFNxkfrdviXyd0dBvZQVfyJM7ZyPl X-Gm-Gg: ASbGncsmS69+awfmilFrFhSU0YAldkZPPLNNZWNGp3l+Fyf83al0GmQ+NaMb4hThZFp X3kZmE5Ab/e9cKlFq+UAu7ue2O2flHANxFTc1RF+4G8baFP/GnscY/bp5OyuX3Akl3BWPJUmCqN jwKYq7EcXrkDQUhV7ixkWA289phd/H5FFWi8aA49bgTFJclEqe+OHTXjAKus6wwe8hBeCTFGyGw ORcEmW2U+A07H3WzfWhwGnSqDOfvmbzosjHWRfXihDcMTMpjJ3svL2oYtrrXIW1ZisWpHPxC8eb auoIu/+j6XJgnyRrZAXnxmp9AOnTJ0GoX7QND4TQfi/5KInjXNMprhsfzjcx3Nrl/77rfDTdWSG l54ab8c5wocLpjQh0fD9qrVZbeQ3S X-Google-Smtp-Source: AGHT+IGlwB3E3iFsoV+RPbthQ2Ea2eKedtqx0x4kCaDJKfU831U5xjQOWACgAkUckWcm5YIZT2beZw== X-Received: by 2002:a05:6512:2344:b0:55b:8285:3f31 with SMTP id 2adb3069b0e04-55cb61ec19bmr1072822e87.24.1754559319005; Thu, 07 Aug 2025 02:35:19 -0700 (PDT) Received: from mva-rohm ([2a10:a5c0:800d:dd00:8fdf:935a:2c85:d703]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-55b889ac54fsm2615427e87.62.2025.08.07.02.35.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Aug 2025 02:35:18 -0700 (PDT) Date: Thu, 7 Aug 2025 12:35:14 +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 v2 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="at11eeWsaZC/GkIE" Content-Disposition: inline In-Reply-To: --at11eeWsaZC/GkIE 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 --- Revision history: 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 --at11eeWsaZC/GkIE Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmiUc1IACgkQeFA3/03a ocXMxQgAuWytX3w35Hq7qrSK+8M/ivw0OgfVLiolOWqcMKzhReJJPUuA0Qhu6kMY ryfCTeJehZllkJPImRPRCTZecLwkrzYzNdXQWRK98mGcTJiJ2JTHgIECm61cpkIj qL++WtcdbF1uEUxwlSrj/InzZkscrp2ySmqYRUg1+ErWB4DkUVHldoY/M2XV3Q5y oFnhD9B0nYf2Kq7535YkdD8QlJwvE6VOP8rB2qo+VXxNvLM47tlLq5SBbxNsQf3d CXxWyV7nYLPzaSMWlNNkjyqZDt64nxLqAl87ZcppHZlIkPC2oDwUYqItkgf6Xv+b SbmGY0M7BGm+5SIbxM4GWDxO58BIow== =PITl -----END PGP SIGNATURE----- --at11eeWsaZC/GkIE-- From nobody Sun Dec 14 02:05:38 2025 Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) (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 7C5A0254876; Thu, 7 Aug 2025 09:35:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754559334; cv=none; b=mKkNvtBgI1ZX8jiUzn1H4SQ/a59eZEsXrG/8SNLCsYhOojwNubrzmUJXTHBGXg1g805/xe8XeKYI2/sgIfM4f4osaq2Bwd55qGM4zYkMBWCEMOQlIRVN8SxW3tGKU4/oI8FEpmVtPPMsIsOYm2on2GQnY/jcuTUzWwBNTU7JwwI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754559334; c=relaxed/simple; bh=Siz48S+liI6W6M/aRzCxs+H3uw/5bMwmmqls1302Weg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=beCzapR5+y7ZjgG7RmRqtrOcXnJgUtVd98tSJdKx9XnvqyTzJ6rdSpNu0rRLHyU4h+JPP1+rBRO2F7TKE+g+LmDpApe/pPjEYWfiboqtOeO0GlucA+IGtQi4RqCWj7lIKGwn/H/tyTehDRQX8o+wWy3MIK5ACwje5UQLL/FfGgM= 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=mIuf9jGf; arc=none smtp.client-ip=209.85.208.177 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="mIuf9jGf" Received: by mail-lj1-f177.google.com with SMTP id 38308e7fff4ca-332590cc87fso6659381fa.3; Thu, 07 Aug 2025 02:35:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754559330; x=1755164130; 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=uDecFcqmjWF2jDhd7cAyPmPfhLM6PzWjpX5jhJB/FOQ=; b=mIuf9jGf8ujolCR7aAXJCHzcTeeliZ5QW/RBfbz5TpaQWhQ7I6zr7eQkB9V7fRN14w Y6OmCvRIrj4VqmAfiLTcl6mY5n60nkIjxSWO3nb75YQqbXc+42WxnVAFJFZd8V22KWsK zwaPnrGnw2VbeZt6cvH2VC1Gn8PPBwWWCdeIlJ2LQ9w15D81PJrrQuFt7tRNkPF48Xfa bGUSl2dyQGC3+s6A8qmb+pTk7bI0ihh/nnbQ9dXJRvgvDBVjj0GyVhfDO7jLFz85N8Sh NzOgKTNJx86rocn8XUXOtCYtUFSuKhTpI2srllKzueDOep70drN9S6X4PG++tyr7BTnM 9UIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754559330; x=1755164130; 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=uDecFcqmjWF2jDhd7cAyPmPfhLM6PzWjpX5jhJB/FOQ=; b=uBH3Cy2LdBx2vdcO0cGci0uvGvUMeGcJdO0ICGUefPgORsnnnKE2+/G4CPxaYI2tWA bMb/cTrqeiG7WlGajpbgkmZHsKdM0s9pJ9VAQOx41qvk71phbEWeO6zkk9wPEZELKeTy VgRDGagPUjutk+X8KmOvvoxfow8jMHhETbakKHS3nCQXed3lNKn0tCfQGJvi608NMHgk 2xOWprYh5CepbuQEo05uXMD65X23Vll94KMvk/9IMMAId97vmceCAOOa9wqDVrWR8DlH 1j2ipSfZQdHI3fxZ/pFPd2Krncv9hl+65LwCEW1xJyc54o2hw//CXVo5Y9gGIhsqSVpU DbOg== X-Forwarded-Encrypted: i=1; AJvYcCV/S3tf5Td5XQqAODPZ0lBfixI7uvGFk7XzTJPFEqK/bFHuhLXBWFnOyDo05bi0r4ljLabXdp7PYpuJ@vger.kernel.org, AJvYcCV6iRCAcP8ImPVtDUfhjBTZwxvAKJ6jCNg4n697kiFnHF458CtEG0y+7WCEiLGCC0Gi5OmQCS3qZK0n@vger.kernel.org, AJvYcCVOJxfTPJD0MyBbamoJwZE/3ZP5uMZefVqPVv/PCQLBXOnjq0sci1WIfvsyIBeudMfyqE9aDF7hMLDkKLwt@vger.kernel.org X-Gm-Message-State: AOJu0YzE9fnlNF9aQc0Da5JPlcZ9C3W+4r/OjGEnUEUmz7Ge0Kxr5sz3 n2GpIGPNEXSQWeGzJcOPlgAIgXQdQTc5Q5UUJCQeI5bF2Bbdyl+BKR+6 X-Gm-Gg: ASbGnctZk1lN4TT+XWUiIOgTg3UA7VKLTxe3gVueZ3Sc7FkSO28JmZQQKnQG3VR5txU 6KHOovdFpNL8wto0IwRS1oy82TOOZ3xf8dZW2gy+ycQnBzslZR6CT4MRMZ8A24Zi3Gsl9Ti9Vsc 4fPJ+rQ+fIenpo54rXF+ioubLzKKfJFlAYMvPwPUc2mm1+bGzwgB8PDcw88GxsUU6Fmq7GtV6Ia J2GMGGgIsK4aoIwn6Ziuz7qb3FdCBjnaIrnhOUXX4Mp1sl2OhVh1SAzYXbtR2Abe6Sdv7d1uEu8 w48nbJFJTb9RxuRyDjNeoAKtXGKhR1yQPfPW8iHbOtbboxkb+9zxvB8YmjBKPObctrlxx7ak0dx UtdUNQKMlUlBPCA3jTfRfAl6Izain X-Google-Smtp-Source: AGHT+IFA5bhiuAB1VJf9qdAQJ8NLlGe3pEmYc9PAupbjTt3MpiUIH0SBoyHUBrE3C8gn9dkvRyZhuQ== X-Received: by 2002:a05:651c:20d0:b0:332:3794:aa2f with SMTP id 38308e7fff4ca-33381290cc3mr6598701fa.14.1754559330201; Thu, 07 Aug 2025 02:35:30 -0700 (PDT) Received: from mva-rohm ([2a10:a5c0:800d:dd00:8fdf:935a:2c85:d703]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-3326cdb7481sm13100031fa.75.2025.08.07.02.35.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Aug 2025 02:35:29 -0700 (PDT) Date: Thu, 7 Aug 2025 12:35: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 v2 09/10] iio: adc: ad7476: Support 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="8etcVA/yzcjN15sC" Content-Disposition: inline In-Reply-To: --8etcVA/yzcjN15sC 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 ISO. 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 --- Revision history: 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 | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c index 8914861802be..aa8a522633eb 100644 --- a/drivers/iio/adc/ad7476.c +++ b/drivers/iio/adc/ad7476.c @@ -31,6 +31,7 @@ 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; }; @@ -39,6 +40,7 @@ struct ad7476_state { struct spi_device *spi; struct gpio_desc *convst_gpio; void (*conversion_pre_op)(struct ad7476_state *st); + void (*conversion_post_op)(struct ad7476_state *st); struct spi_transfer xfer; struct spi_message msg; struct iio_chan_spec channel[2]; @@ -63,6 +65,21 @@ 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(st->convst_gpio, 0); +} + +static void bd79105_convst_enable(struct ad7476_state *st) +{ + if (!st->convst_gpio) + return; + + gpiod_set_value(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; @@ -80,6 +97,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->conversion_post_op) + st->conversion_post_op(st); iio_trigger_notify_done(indio_dev->trig); =20 return IRQ_HANDLED; @@ -271,6 +290,20 @@ 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, + .has_vref =3D true, + .has_vdrive =3D true, +}; + static const struct iio_info ad7476_info =3D { .read_raw =3D &ad7476_read_raw, }; @@ -325,6 +358,7 @@ static int ad7476_probe(struct spi_device *spi) } =20 st->conversion_pre_op =3D chip_info->conversion_pre_op; + st->conversion_post_op =3D chip_info->conversion_post_op; st->convst_gpio =3D devm_gpiod_get_optional(&spi->dev, "adi,conversion-start", GPIOD_OUT_LOW); @@ -400,6 +434,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 --8etcVA/yzcjN15sC Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmiUc10ACgkQeFA3/03a ocXIYQf8CpftaiR0rZJNDqS0b6RjPMR1TrceGpkv1ps4436Mcwuwb5rBCol+fwkS ui2ao0zOF8OMipI5AgRT7oNYfcKEG6yIT486K89XGesC9sp+5454tVeeFYYAvb5g IclKYi+bAMA4Nl99x2C/7ZPfomlCFDVNUXowNZ4YHMbXuEx8fyDiP5NgWf1DzVoP crJuXosGfXIp22B1t6xkq/x8rafvd8gbP0fA82LVO+VpPfgXY4egleeWfVbkjULX kcqDSiGpvYLCVUVhMXrLRt8g9XTtJlaGQWwZCKZ6TdOi1TEB4Ztmg2QCOq6s66+y EscTBwhDi7fOxvMH3VTeWl3iU939Hg== =uiYC -----END PGP SIGNATURE----- --8etcVA/yzcjN15sC-- From nobody Sun Dec 14 02:05:38 2025 Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (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 D80A4257ACF; Thu, 7 Aug 2025 09:35:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754559345; cv=none; b=dhEdh+wvnZqv/HsWMZ4kf9BO359DUcCyW9jU9U7NcyphVdbRq56Khp7xr85FWQKvGdV/+JMUNDVIlozGRpBasEhzV+KaUHDw1vod7amG3IdqntM300VVYGoehuNdSqSjkzaSIm24vc+yHQKGSjqtmXKAGjt2nt3muV1cdjlQZVw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754559345; c=relaxed/simple; bh=3ZmZxda5fwI6t9T+++UojtC/Ikta8I6rVnxdF3YhgRo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NM+5VhTXxMOf+mE7atF07EbjFxVWTJS3Br8lf+ke26qkGJ1gVDtLjQZRFLuWjL+zNdQ7HRFV0zkO7ogtNG9J2DPSYSqHMCwXEAd7uA9jWZjaSvSLBSUpiWYnVgr1Z779l/ulyCJAaIa6zY7sC9ufnewO8G95FuLtF/0qgA0Hvkw= 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=i829ksI0; arc=none smtp.client-ip=209.85.167.53 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="i829ksI0" Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-55b827aba01so771065e87.0; Thu, 07 Aug 2025 02:35:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1754559342; x=1755164142; 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=EQS5hdBw6jdDe9JhXS58Gfk518osTqMd8NXHuh/iDro=; b=i829ksI0JFAGoQyv6uuNSvGSilUqyJAqZl3F1L6FN+q61EvqktakPwESwJinOL5EOt XOuiBQ02TOrmPueklsijmNg02+eTV9yhiflVZHZ7D+e13VDEhW9yC1ep0ibUkwuZjQty IEGe8CxH6E0nUqmqh68utNUFpX3GUNSoKQoEhKtvzSuYaEQkGbYie0y0q5+NRfQ0UIfr 0U/+cnbvA17scmoJmyK6uM8cxk24HsEDKaIF5PZElybyDAQUILVxlChrgyewNUGs7+FB CO2uUF46hsVViJCGbDeIGU8ZWETDIISGTpKKnxV1ZSykXAQDz5mWmohL1OjcaCvz6DTE xwOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754559342; x=1755164142; 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=EQS5hdBw6jdDe9JhXS58Gfk518osTqMd8NXHuh/iDro=; b=FOUEoODVkcLvM1pO+fZQDMDqtSVvVRb4zmy6f0UEQAriykxDJcENvR06E1v/ghbYGL dYq1l/DozFYl6IQRkCZ6duzxphHCPveUAQOm2GDLQUdH2PC0XDv4BYgYyZe6llkOtyeX rU5ycJBn83MaH7pHLGqX+osviA/LzKcTYQCSZZEHoHo9WxgW7sBwKbweUACipbmA+mty dtWViza7lVnIDGm0jB+S/bxNbnZ1TyuUjm0CwSzNUKRfmXRAYqK+olWTmY8T0tt4ro9y gqaYnqe+AbYa23M32TalU+r/gvzAu5kLFjJHOlqI7A8O50mgtksMzXmEaVEofPG7OQU6 7+Kg== X-Forwarded-Encrypted: i=1; AJvYcCV6co2FM6OsdWBpIqhJRRkpktdnKPz4ql/htBc0uj7TqoDfCZ7wjGJJObEcHCHpICRWgSPmD0nFWEdXpZzn@vger.kernel.org, AJvYcCVGGGBmpjUVUsnWXebx8Ad7dhubwVyAhu41oiMWRvgERmwYcTdNr/et72Fx1UQxd8mPmzv5UH6oqkkI@vger.kernel.org, AJvYcCXEXJMJ/A0tOkJirNdzgkMxwUyrMQ+ejn5QqvyCAdRBYxAbTe8ezw4plTFleC2zwskNRUO1/b3z6qtI@vger.kernel.org X-Gm-Message-State: AOJu0Yy841DYQTDNQm4jblKEXKSD8IAKLxMBzRwg9zfVrIef/AmI2OjQ xizk0ipcoq4auPNPa1PznaAb6t1BECf/TwE90bdBYGeIji3In3yg2kQa X-Gm-Gg: ASbGncvYiE4pmQ2cJ5tIM/PdCZv9mR371i1n0airixCbLifcNbugbB6UOoDJNVdcS3k sqe2eltxPwS04d4sqNcZlBdODJTM0T2Hh6QiBv/oKUzVQQvm8AGwZHrByCeAmDpzeotJ8T51ydx AJPhvPdG1xcHmALMV2v4sAmxMLf5pfekFgnyEng4aERGaW57flIJoF6lm0oq4FmhFLthqNZN4ud UNV0h8c02yXRAyptFts91oT3DvQDYbGghwLb8PrI3sM9Z+GQ8+d5bqD5KwydZnfsfb9rqo9GCuK MoZn2R/YF13TXupPX1v9YsqI2bqThQTXmH3fAbMSP+vL9R7hUXmwsu5gqO19S0M6+jqaVH82CQx fYUFKoTinxes/1ZbXHFM9Cx6k++3m X-Google-Smtp-Source: AGHT+IHwpS9xPNMbyeflY/IkeZw7hFymrnWVT43OPpHQfrsf9G7ixdFFvLxl0FqGrRVLeme0HxatMQ== X-Received: by 2002:a05:6512:2395:b0:553:2ee0:7728 with SMTP id 2adb3069b0e04-55caf45444bmr2076994e87.0.1754559341705; Thu, 07 Aug 2025 02:35:41 -0700 (PDT) Received: from mva-rohm ([2a10:a5c0:800d:dd00:8fdf:935a:2c85:d703]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-55ba8954f0bsm1022001e87.162.2025.08.07.02.35.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Aug 2025 02:35:40 -0700 (PDT) Date: Thu, 7 Aug 2025 12:35:37 +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 v2 10/10] MAINTAINERS: A driver for simple 1-channel SPI ADCs Message-ID: <008ef72e484906cf4760f99eab6bfcd7a4b3c4be.1754559149.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="kEIOraG57ZNktAFU" Content-Disposition: inline In-Reply-To: --kEIOraG57ZNktAFU 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 --- 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 --kEIOraG57ZNktAFU Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmiUc2kACgkQeFA3/03a ocUqCwgAs1dmwvRjQSh7iYhvrvM+e590DW8p7gXDISZt8rRXRu8ebrZztFD9UwLP xmnakfPq9Tj0UX3GwzarBS020+UCL4rAPz43QQYQOxj5B68DQCQXmHLNju3QX2by ThYNmhIwjnJWnLaP7XtnqMd79wVN5ausm3xHk5v1MR8u7ACsSoVBnSC+etRHKkYL FzpOD281q1eROzUF9DiooqfHIJZ4Wr4PvQ6HTKJhMv6hAGiihRf7qgV2Fpo7Xha8 CKs8nO54Io7o/C4eIfAomslBRhWlSQwulwn82EGRk1pJHVEoSs0xPiNHrNAdIYk7 5OaYm6MqXZW7A5EWBDYV+sPtiYmupQ== =b8D0 -----END PGP SIGNATURE----- --kEIOraG57ZNktAFU--