From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B9DAA13AA3E for ; Thu, 13 Mar 2025 07:17:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741850234; cv=none; b=XjsPk7cPCMNe41tlqqEZy6oW5+7LqhEMdfz4EcOD5tbcbKdpT2K1wrxfzAdM1VxyQFgN1FA32xDWhCUNRaJz8bCOtQIAdEyjqav1wZuQfUzHBu/UAO0mzbjvug4EHDtok7zuG4v+0GpmP1n5lZvsESYZWPfLkRvkVsAAaXtDBiw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741850234; c=relaxed/simple; bh=naI9JVR3MUeCMddBWDH5dmeWuvYgRpMlDDy8bd4HaCs=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=FtdYPSJiGVbhemJMSn6Z/tJmU9D0u3apyNPcPiuqfuFIKWmqtDB0aiDjhffhGF1eJPosvTqOC7E+8iFbAv9kV+2RKWEVFFOoQDWEPc/qjp0WTqDxmPqr78XWhFn/qsudZnvt5CT+1MEzdfJ/REDx4nvd+MBWcJwR/QA5/PSzv60= 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=YTptnzdB; arc=none smtp.client-ip=209.85.208.175 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="YTptnzdB" Received: by mail-lj1-f175.google.com with SMTP id 38308e7fff4ca-30bd11bfec6so7054691fa.0 for ; Thu, 13 Mar 2025 00:17:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741850231; x=1742455031; darn=lists.linux.dev; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=P5WHcmvIMGQWDWl3ITE+2vt5egvOVi0st3Z+q7JAjLI=; b=YTptnzdBqqwndajz155y/A2VSTjojw8FQX8UjT/ShasoCptrbcy1rwuKEw2ezM0Spk j8jGZT7p+b/SVmHW2yb8qGKhO+2SGms+4biDnXMsfJsXCyF9Rt2IFFzUBxaoD3D51Vw6 8laoCSjNqAjd00Mr41ooIPexPlZbI9r2J+P0NXonJTn1kY2imrtd5mjcJIvhcHCHRhSD xrQANThQyjww92qIzqK2RCYgLkvviqXvZfjffbRUWwug+qwQqFRJE2CzeEn4iBBo+7MC 758yIftI6TXpjQ3SEmWjszxdaGsdTLs/Oar3R7Ry/v2YPVXzRvdUyMULSzhPnoOof7Xf Ixow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741850231; x=1742455031; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=P5WHcmvIMGQWDWl3ITE+2vt5egvOVi0st3Z+q7JAjLI=; b=q/VoxZ/aqJm7ykuST6DSeXAdOjLcCMWDR1oJ3FpRHZXjxszzoVSfmitxsBHVLzdnC6 027egzZH+RBOHkcYm0VwFtSeSgvBeEqGpgewpg4qWfT1ikMChoNRhim4jHc8zFb8mjzh LGlBV1Os0DAPudSE3AxtdvXwoezBD+qNpqjD68IVz9OQ3HoWTL/kCGRnmGnVIbHAj/h/ zINDuQnFQoRaS0c/7A6hLWMKxmTHfeTFBbT1dq94GS9GLC+QqnaGG1uKJcWE8DjDqmKj Um5et+IEpKdtiwd31y5MhmG312ITWZHsLBvThJGmXDENz5sMBE/+eEWe8SfX9yKe2aKw sw9A== X-Forwarded-Encrypted: i=1; AJvYcCUPrgJJQYtmFQOW6Fl1R4P1347YrEXqSCeikIs/f7w7MGut9xmzq4KqdFv1WVvk+ERQrVvcxg2qf8ZPBw==@lists.linux.dev X-Gm-Message-State: AOJu0YxfdtKmyVIgKAaTzt1IeCg1YLCd/EjJ/7zhivLA7FJ+3z3OhjUG ZLXJs3LWFmF1TIhrEqvTn7hBoA/IM94Gbvpf3O8fmGFboH8yMsYD X-Gm-Gg: ASbGnctvl5RdBAMqvPXAdpBh3FIBkzVhCc8duxqVwTOsD9j/GoqqqQ3SsVGDzbL2GYD AN7hN+kz6vZ+X/6G8rn8avi4WWFm7eBNdcWIV0uE9iIUGGFC3PuWCW1rka/4YcP7xavGFx+OVx1 lXAr4WMXyOMhMFdnRELFAOshWvbAJtnUC8Gx2zs1ijhTp2Yj+ovxFPPpT0aHao9qNhNa5LHMxr0 8pyLSQ7R2XGaDbWQivlWA/nd8+a/jaecO/8VtiI2XvHoH32Q7187yeWVvNrdTdkM8+v3BX/M2th AZSPtiEYzCPqdh2X3SCzLAL/wbjMyjoKwA3Ao3a/6t3o5Lupkoy2i1ZYKPZ4lA== X-Google-Smtp-Source: AGHT+IHx3X2FqctNBmr2hZceebB3bJJVXoyrN9cDqpAfPu3OVpvwfWDgftPDLFysrAbjWyTNApS5UA== X-Received: by 2002:a2e:a7c1:0:b0:302:22e6:5f8 with SMTP id 38308e7fff4ca-30c206c0ccemr44055391fa.22.1741850230372; Thu, 13 Mar 2025 00:17:10 -0700 (PDT) Received: from mva-rohm ([2a10:a5c0:800d:dd00:8fdf:935a:2c85:d703]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-30c3f0d2574sm1227071fa.7.2025.03.13.00.17.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Mar 2025 00:17:06 -0700 (PDT) Date: Thu, 13 Mar 2025 09:16:38 +0200 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Javier Carrasco , linux-arm-kernel@lists.infradead.org, Samuel Holland , Sakari Ailus , netdev@vger.kernel.org, Rob Herring , Matti Vaittinen , Herve Codina , Thomas Bonnefille , Jernej Skrabec , Nuno Sa , Laurent Pinchart , linux-media@vger.kernel.org, Jonathan Cameron , Claudiu Manoil , devicetree@vger.kernel.org, Marcelo Schmitt , Lad Prabhakar , Mauro Carvalho Chehab , Heikki Krogerus , "David S. Miller" , Lars-Peter Clausen , linux-acpi@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-iio@vger.kernel.org, Krzysztof Kozlowski , linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev, Eric Dumazet , Conor Dooley , Danilo Krummrich , Olivier Moysan , Trevor Gamblin , Ramona Alexandra Nechita , Paul Elder , Greg Kroah-Hartman , Matteo Martelli , Guillaume Stols , Alisa-Dariana Roman , Jakub Kicinski , Andy Shevchenko , AngeloGioacchino Del Regno , Dumitru Ceclan , Paolo Abeni , "Rafael J. Wysocki" , Andrew Lunn , David Lechner , Chen-Yu Tsai , Daniel Scally Subject: [PATCH v7 00/10] Support ROHM BD79124 ADC Message-ID: Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="7xzkgzh6Rt0Ce+oi" Content-Disposition: inline --7xzkgzh6Rt0Ce+oi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Support ROHM BD79124 ADC. This series adds also couple of IIO ADC helper functions for parsing the channel information from the device tree. There are also new helpers included for iterating and counting firmware child nodes with a specific name. Series does also convert couple of drivers to use these helpers. The rzg2l_adc and the sun20i-gpadc are converted to use the new ADC helper. The gianfar driver under net and the thp7312 under media/i2c are added as first users of the newly added "named child node" -helpers. There has been some discussion about how useful these ADC helpers are, and whether they should support also differential and single ended channel configurations. This version does not include support for those - with the benefit of reduced complexity and easier to use API. NOTE: Patches 4,5,9 and 10 are untested as I lack of relevant HW. They have been compile tested only. The ROHM BD79124 ADC itself is quite usual stuff. 12-bit, 8-channel ADC with threshold monitoring. Except that: - each ADC input pin can be configured as a general purpose output. - manually starting an ADC conversion and reading the result would require the I2C _master_ to do clock stretching(!) for the duration of the conversion... Let's just say this is not well supported. - IC supports 'autonomous measurement mode' and storing latest results to the result registers. This mode is used by the driver due to the "peculiar" I2C when doing manual reads. Furthermore, the ADC uses this continuous autonomous measuring, and the IC keeps producing new 'out of window' IRQs if measurements are out of window - the driver disables the event for 1 seconds when sending it to user. This prevents generating storm of events Revision history: v6 =3D> v7: - Inline device_get_named_child_node_count() - Fix kernel-doc for fwnode_get_named_child_node_count() - Minor styling fixes More accurate changelog in individual patches. v5 =3D> v6: - Drop applied patch - Add *_for_each_named_child_* iterators - Add a patch converting the thp7312 driver to use the new helper - Styling and minor things pointed by reviewers v4 =3D> v5: Fixes as per various review comments. Most notably: - Drop the patch making the TI's ADC driver to respect device tree. - Add (RFC) patch converting gianfar driver to use new name child-node counting API as suggested by Andy. - Add fwnode_get_child_node_count_named() as suggested by Rob. - rebase to v6.14-rc5 More accurate changelog in individual patches. v3 =3D> v4: - Drop the ADC helper support for differential channels - Drop the ADC helper for getting only channel IDs by fwnode. - "Promote" the function counting the number of child nodes with a specific name to the property.h (As suggested by Jonathan). - Add ADC helpers to a namespace. - Rebase on v6.14-rc3 - More minor changes described in individual patches. v2 =3D> v3: - Restrict BD79124 channel numbers as suggested by Conor and add Conor's Reviewed-by tag. - Support differential and single-ended inputs - Convert couple of existing drivers to use the added ADC helpers - Minor fixes based on reviews Link to v2: https://lore.kernel.org/all/cover.1738761899.git.mazziesaccount@gmail.com/ RFC v1 =3D> v2: - Drop MFD and pinmux. - Automatically re-enable events after 1 second. - Export fwnode parsing helpers for finding the ADC channels. --- Matti Vaittinen (10): dt-bindings: ROHM BD79124 ADC/GPO property: Add functions to iterate named child iio: adc: add helpers for parsing ADC nodes iio: adc: rzg2l_adc: Use adc-helpers iio: adc: sun20i-gpadc: Use adc-helpers iio: adc: Support ROHM BD79124 ADC MAINTAINERS: Add IIO ADC helpers MAINTAINERS: Add ROHM BD79124 ADC/GPO net: gianfar: Use device_get_child_node_count_named() media: thp7312: Use helper for iterating named child nodes .../bindings/iio/adc/rohm,bd79124.yaml | 114 ++ MAINTAINERS | 12 + drivers/base/property.c | 27 + drivers/iio/adc/Kconfig | 17 + drivers/iio/adc/Makefile | 3 + drivers/iio/adc/industrialio-adc.c | 79 ++ drivers/iio/adc/rohm-bd79124.c | 1107 +++++++++++++++++ drivers/iio/adc/rzg2l_adc.c | 38 +- drivers/iio/adc/sun20i-gpadc-iio.c | 38 +- drivers/media/i2c/thp7312.c | 8 +- drivers/net/ethernet/freescale/gianfar.c | 17 +- include/linux/iio/adc-helpers.h | 27 + include/linux/property.h | 24 + 13 files changed, 1449 insertions(+), 62 deletions(-) create mode 100644 Documentation/devicetree/bindings/iio/adc/rohm,bd79124.= yaml create mode 100644 drivers/iio/adc/industrialio-adc.c create mode 100644 drivers/iio/adc/rohm-bd79124.c create mode 100644 include/linux/iio/adc-helpers.h base-commit: 7eb172143d5508b4da468ed59ee857c6e5e01da6 --=20 2.48.1 --7xzkgzh6Rt0Ce+oi Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmfShk0ACgkQeFA3/03a ocWNpgf/TG9MRdXix3NCy8/EzhHwwwGPzHkZu844kW+j84Ro7p67BMd87uiY6kj0 SWfT77vNLXFXNhHhTOGYXjdtLxaXsmqWCOBzmafT93NAXmBIE/Ypis7uSZe0xmRc hAzDEhE0bHEaLzu+Dlln4Ud6wc3wayHSbGDx6810Gh6JQpfbdbY6boyE3F+5yy+b erV2JcPGKfjMfQVeVy4kIXHrjeTphelK6HIwS64lLSkzDsL6V4oMkNThXpFG27t7 P94a2cMBiNvX5g55O3VusaA5uyN7ab1uETa1jvvI9e8liARAp31nkbXJCuLb7AKB 56rkfS4sM+2R7cLBLSxTqts/5xjWVQ== =laFK -----END PGP SIGNATURE----- --7xzkgzh6Rt0Ce+oi--