From nobody Thu Nov 28 06:45:26 2024 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 121A615573B; Thu, 3 Oct 2024 11:46:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.198 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727956011; cv=none; b=Q/zY9oOxy+1xN5uhv8dnG8DfyHdEwif720WlEcszQ/jVN+7ID9bZbZhGQShUfBQFpVgQJIrsFMvtwqeShGz2KJt9QdSadwoNTI3AGV6WN9wNXUZIV9FByqx3CZq2fvHNCKVFiVCS29/Y+T6zdH563NkxoMR1qwsotT9r46tjsJ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727956011; c=relaxed/simple; bh=7GhuE30cA1jnzqBKR2T3/t4sGXf69ji3SvSDZRPJ4zs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qynndglaohPO6phCflsqfCYMm5dryjwN+UGt+MEz1OwLKPIZ2v9hPO31W5AwSnkrczI7ahxGmq2eHPJvebf4GhskcyvVOzNfQjxfp/0UmtWD2ecqerTUg0KeU1zHOPysXNkcIoL48RMDsYfYUwlAPRuWtko/+gcxO4ns+ozu+9o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=ap9xvR4+; arc=none smtp.client-ip=217.70.183.198 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="ap9xvR4+" Received: by mail.gandi.net (Postfix) with ESMTPA id A39E1C000B; Thu, 3 Oct 2024 11:46:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1727956007; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E/FviqtWurVfEYS8t+3LSa3BpkRr5YVuFEV/OTJuwPk=; b=ap9xvR4+QcB7spRwIMW2drKroCelhM3w0307X+tZw0xVXsrybF5XuMklnPEmm7grwKoLOJ WI0WGpjM0JsWRJO+BNHCaZq0ilhsIZkvN3TTrXRVnsg8KzZDwCAZKacuoQEOTXhkPJ6vWD h1MwNjHv05rQtloYyTqB+NjoqQtexHoXcDac8m7l57Fz/2FjYQ0oE19yswKUU7+H83TgFi 9e75Sdj2Y2THCkAGXXDwk8UdRbYeZnznTPpVEe05moexyGJE/QoCQQcuLyK9s6sDRvMUMF Ql1eMG/0HQDOA/WDzt40i82olDmUmDXbMmsK1T1x/G5BbTeMqlSd/AIMkD4A0A== From: Herve Codina To: Herve Codina , David Lechner , Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Luca Ceresoli , Ian Ray , Thomas Petazzoni , Conor Dooley Subject: [PATCH v2 1/4] dt-bindings: vendor-prefixes: Add an entry for GE HealthCare Date: Thu, 3 Oct 2024 13:46:38 +0200 Message-ID: <20241003114641.672086-2-herve.codina@bootlin.com> X-Mailer: git-send-email 2.46.1 In-Reply-To: <20241003114641.672086-1-herve.codina@bootlin.com> References: <20241003114641.672086-1-herve.codina@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-GND-Sasl: herve.codina@bootlin.com Content-Type: text/plain; charset="utf-8" Add the "gehc" entry for GE HealthCare. https://www.gehealthcare.com Signed-off-by: Herve Codina Acked-by: Conor Dooley Tested-by: Ian Ray --- Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Docum= entation/devicetree/bindings/vendor-prefixes.yaml index b320a39de7fe..15877574a417 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.yaml +++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml @@ -561,6 +561,8 @@ patternProperties: description: GE Fanuc Intelligent Platforms Embedded Systems, Inc. "^GEFanuc,.*": description: GE Fanuc Intelligent Platforms Embedded Systems, Inc. + "^gehc,.*": + description: GE HealthCare "^gemei,.*": description: Gemei Digital Technology Co., Ltd. "^gemtek,.*": --=20 2.46.1 From nobody Thu Nov 28 06:45:26 2024 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DBBF0156F2B; Thu, 3 Oct 2024 11:46:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.198 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727956012; cv=none; b=WJQNfPeKpkODl4+WFlwCTUXtDnzXEDHkYnONzXFhQFmxFVmIGSIdqJwPd+PJuJPiNnjeEOOGdKC1jvwG0C8oy9Am9fgY+Eab24xbSIhFIMDP3SEle9zzeC38AdCZkuVughGgJWvXDS3M1Texd48Bz0KNyW8F/++p+VPHsiXNQOQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727956012; c=relaxed/simple; bh=h3LS5n4pvalkUgi1BZ4Ks4B4Rb5GjW863XbmDr2s9V0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OiP1AXxWGxuZKQnrgjtWlaa1rGpvzrif/D++C6MxnddhtAS/469szdimmAPeb+h7CgO6B0zAJfWuGCYKNBzb7DxtoJiRp5+TlSgENXZQVCaIuo2cc+/pC9sD6vz+NIvNC2AGBO7Fk2ZATVRs0Xj6ccNu//AkmikSth4pkF1RruE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=i/gO/LMc; arc=none smtp.client-ip=217.70.183.198 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="i/gO/LMc" Received: by mail.gandi.net (Postfix) with ESMTPA id 88D4FC0003; Thu, 3 Oct 2024 11:46:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1727956008; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lkiSM+vn4ME69DaeEjqEky/BkDXAljK/2OzQ+ielh14=; b=i/gO/LMcwQzsPoVF/XnjYIOEIIJpoe7HMfZ7fVy0+MyGdWsuSPFG3lRvbb6smIyquig823 uZIzx756GdFKMcHWfGlpeMYl/bJHDAwhtg6jUvnMMWz/NrVJTDwCCBVkAdTk3YNmg04fb5 YWkpiMVytU5emAiWHM+eZ3atjYXuP0OOWDc6ggjdMslvbXvW8uNcYwcR8m6fIr+rfILtNA AZiRhYmV736nDPQgHoEfglzLzjVdVrdLSEwmKmHB9YnR0PwehrnzHa7w60TOtDb+m5gFH8 KicKAcutK9X+XE4rLNvcq4wgNNqPjJj0hN8NbdD7gXP/lFAQkE/VSqz1aSeZUw== From: Herve Codina To: Herve Codina , David Lechner , Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Luca Ceresoli , Ian Ray , Thomas Petazzoni Subject: [PATCH v2 2/4] dt-bindings: iio: adc: Add the GE HealthCare PMC ADC Date: Thu, 3 Oct 2024 13:46:39 +0200 Message-ID: <20241003114641.672086-3-herve.codina@bootlin.com> X-Mailer: git-send-email 2.46.1 In-Reply-To: <20241003114641.672086-1-herve.codina@bootlin.com> References: <20241003114641.672086-1-herve.codina@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-GND-Sasl: herve.codina@bootlin.com Content-Type: text/plain; charset="utf-8" The GE HealthCare PMC Analog to Digital Converter (ADC) is a 16-Channel (voltage and current), 16-Bit ADC with an I2C Interface. Signed-off-by: Herve Codina Reviewed-by: Conor Dooley Tested-by: Ian Ray --- .../bindings/iio/adc/gehc,pmc-adc.yaml | 86 +++++++++++++++++++ include/dt-bindings/iio/adc/gehc,pmc-adc.h | 10 +++ 2 files changed, 96 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/adc/gehc,pmc-adc.= yaml create mode 100644 include/dt-bindings/iio/adc/gehc,pmc-adc.h diff --git a/Documentation/devicetree/bindings/iio/adc/gehc,pmc-adc.yaml b/= Documentation/devicetree/bindings/iio/adc/gehc,pmc-adc.yaml new file mode 100644 index 000000000000..2cea7c104a26 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/adc/gehc,pmc-adc.yaml @@ -0,0 +1,86 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/adc/gehc,pmc-adc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: GE HealthCare PMC Analog to Digital Converter (ADC) + +maintainers: + - Herve Codina + +description: + The GE HealthCare PMC ADC is a 16-Channel (voltage and current), 16-Bit = ADC + with an I2C Interface. + +properties: + compatible: + const: gehc,pmc-adc + + reg: + maxItems: 1 + + vdd-supply: + description: + Regulator for the VDD power supply. + + vdda-supply: + description: + Regulator for the VDD analog (VDDA) power supply. + + vddio-supply: + description: + Regulator for the VDD IO (VDDIO) power supply. + + vref-supply: + description: + Regulator for the voltage reference power supply. + + clocks: + maxItems: 1 + description: + The component uses an external oscillator (osc) if an external oscil= lator + is connected to its clock pins. Otherwise, it uses an internal refer= ence + clock. + + clock-names: + items: + - const: osc + + "#io-channel-cells": + const: 2 + description: | + The first cell is the channel type (dt-bindings/iio/adc/gehc,pmc-adc= .h + defines these values): + - 0: voltage + - 1: current + The second cell is the channel number from 0 to 15. + +required: + - compatible + - reg + - vdd-supply + - vdda-supply + - vddio-supply + - vref-supply + - '#io-channel-cells' + +additionalProperties: false + +examples: + - | + i2c { + #address-cells =3D <1>; + #size-cells =3D <0>; + + adc@14 { + compatible =3D "gehc,pmc-adc"; + reg =3D <0x14>; + vdd-supply =3D <®_vdd>; + vdda-supply =3D <®_vdda>; + vddio-supply =3D <®_vddio>; + vref-supply =3D <®_vref>; + #io-channel-cells =3D <2>; + }; + }; +... diff --git a/include/dt-bindings/iio/adc/gehc,pmc-adc.h b/include/dt-bindin= gs/iio/adc/gehc,pmc-adc.h new file mode 100644 index 000000000000..2f291e3c76ae --- /dev/null +++ b/include/dt-bindings/iio/adc/gehc,pmc-adc.h @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause */ + +#ifndef _DT_BINDINGS_IIO_ADC_GEHC_PMC_ADC_H +#define _DT_BINDINGS_IIO_ADC_GEHC_PMC_ADC_H + +/* ADC channel type */ +#define GEHC_PMC_ADC_VOLTAGE 0 +#define GEHC_PMC_ADC_CURRENT 1 + +#endif --=20 2.46.1 From nobody Thu Nov 28 06:45:26 2024 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CBECC161310; Thu, 3 Oct 2024 11:46:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.198 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727956013; cv=none; b=NRxFlitkQDtRXSPxEmpRJb84LmLeqBQHmR5NB3/4IKIjZ7ThA3TAcLYAW6Dd6BzQx9AY2DR1pJoAYJmWY2fJeKTyK+3ZbQ8b/jF/lzMVqZ30ACSpC3FX5z3Oc0z2f5z05CGWa5aRLBab3cyZ5epIyZylgyv3KSw7rvQf++rlUPI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727956013; c=relaxed/simple; bh=wTEmwBj8zmnWMsxPDvDa9/qESvHneb47rmv6v4zw5dM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OkH3LpodiPoGkhk5gLOpNeZaSUr84Mmw/xnuymGgBncHBmt+lhIE/K//CCkorkEBt9qFh5/RWbrT/1zKa4b4bS4p+fXTYbwmQwU25XTzNvLrwlyffVXs2uazPO93giCW1CnUjT/ZoVGnIVG6yGYaU+lTpMAYSRL+m/P+CBvIsDE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=eMuR90CD; arc=none smtp.client-ip=217.70.183.198 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="eMuR90CD" Received: by mail.gandi.net (Postfix) with ESMTPA id 5D85CC000A; Thu, 3 Oct 2024 11:46:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1727956009; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SdxN7iYl8GGlNdvRLtUhc9B30FDhzLCrq44oPUZRrO0=; b=eMuR90CDfHhC8rnME8cG1ao7Pa+gp3ZyqXJNBpMAicqLXltHng0DEEBPSWyhB6Bk1R3HKV ZGJFrPMG/BKJKqE0+onCuKYWsoG3B3WMlCw2sROVVZGryIertAb9jT8DyLaNETHP9+k54W qUV4SJp2rMf4CTGguwTdZnzhF5Ls7LNbuc9huwbgP2hggMwuYSJ9s1Ly34bDJC7rSlrwwU c1Ca+o9EddWEYAUgne57QBNJGQGFuX0/op5yc9heuiiepNDdpdXTyVxJIpwv83wKoOFrAI 1JOdRlbYS3ojcug3IjRH7vsD5NcdPY6WTQQu+H2WzzwiJfzOofON5bSLAfYrRg== From: Herve Codina To: Herve Codina , David Lechner , Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Luca Ceresoli , Ian Ray , Thomas Petazzoni Subject: [PATCH v2 3/4] iio: adc: Add support for the GE HealthCare PMC ADC Date: Thu, 3 Oct 2024 13:46:40 +0200 Message-ID: <20241003114641.672086-4-herve.codina@bootlin.com> X-Mailer: git-send-email 2.46.1 In-Reply-To: <20241003114641.672086-1-herve.codina@bootlin.com> References: <20241003114641.672086-1-herve.codina@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-GND-Sasl: herve.codina@bootlin.com Content-Type: text/plain; charset="utf-8" The GE HealthCare PMC Analog to Digital Converter (ADC) is a 16-Channel (voltage and current), 16-Bit ADC with an I2C Interface. Signed-off-by: Herve Codina Reviewed-by: David Lechner Tested-by: Ian Ray --- drivers/iio/adc/Kconfig | 10 ++ drivers/iio/adc/Makefile | 1 + drivers/iio/adc/gehc-pmc-adc.c | 227 +++++++++++++++++++++++++++++++++ 3 files changed, 238 insertions(+) create mode 100644 drivers/iio/adc/gehc-pmc-adc.c diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 97ece1a4b7e3..87b20f972c25 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -571,6 +571,16 @@ config FSL_MX25_ADC Generic Conversion Queue driver used for general purpose ADC in the MX25. This driver supports single measurements using the MX25 ADC. =20 +config GEHC_PMC_ADC + tristate "GE HealthCare PMC ADC driver" + depends on I2C + help + Say yes here to build support for the GE HealthCare PMC 16-bit + 16-Channel ADC. + + To compile this driver as a module, choose M here: the module will be + called gehc-pmc-adc. + config HI8435 tristate "Holt Integrated Circuits HI-8435 threshold detector" select IIO_TRIGGERED_EVENT diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index 7b91cd98c0e0..66b36dfe9a28 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -52,6 +52,7 @@ obj-$(CONFIG_ENVELOPE_DETECTOR) +=3D envelope-detector.o obj-$(CONFIG_EP93XX_ADC) +=3D ep93xx_adc.o obj-$(CONFIG_EXYNOS_ADC) +=3D exynos_adc.o obj-$(CONFIG_FSL_MX25_ADC) +=3D fsl-imx25-gcq.o +obj-$(CONFIG_GEHC_PMC_ADC) +=3D gehc-pmc-adc.o obj-$(CONFIG_HI8435) +=3D hi8435.o obj-$(CONFIG_HX711) +=3D hx711.o obj-$(CONFIG_IMX7D_ADC) +=3D imx7d_adc.o diff --git a/drivers/iio/adc/gehc-pmc-adc.c b/drivers/iio/adc/gehc-pmc-adc.c new file mode 100644 index 000000000000..c70a93f4a61b --- /dev/null +++ b/drivers/iio/adc/gehc-pmc-adc.c @@ -0,0 +1,227 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * The GE HealthCare PMC ADC is a 16-Channel (Voltage and current), 16-Bit + * ADC with an I2C Interface. + * + * Copyright (C) 2024, GE HealthCare + * + * Authors: + * Herve Codina + */ +#include +#include +#include +#include +#include +#include +#include +#include + +struct pmc_adc { + struct i2c_client *client; +}; + +#define PMC_ADC_CMD_REQUEST_PROTOCOL_VERSION 0x01 +#define PMC_ADC_CMD_READ_VOLTAGE(_ch) (0x10 | (_ch)) +#define PMC_ADC_CMD_READ_CURRENT(_ch) (0x20 | (_ch)) + +#define PMC_ADC_VOLTAGE_CHANNEL(_ch, _ds_name) { \ + .type =3D IIO_VOLTAGE, \ + .indexed =3D 1, \ + .channel =3D (_ch), \ + .address =3D PMC_ADC_CMD_READ_VOLTAGE(_ch), \ + .info_mask_separate =3D BIT(IIO_CHAN_INFO_PROCESSED), \ + .datasheet_name =3D (_ds_name), \ +} + +#define PMC_ADC_CURRENT_CHANNEL(_ch, _ds_name) { \ + .type =3D IIO_CURRENT, \ + .indexed =3D 1, \ + .channel =3D (_ch), \ + .address =3D PMC_ADC_CMD_READ_CURRENT(_ch), \ + .info_mask_separate =3D BIT(IIO_CHAN_INFO_PROCESSED), \ + .datasheet_name =3D (_ds_name), \ +} + +static const struct iio_chan_spec pmc_adc_channels[] =3D { + PMC_ADC_VOLTAGE_CHANNEL(0, "CH0_V"), + PMC_ADC_VOLTAGE_CHANNEL(1, "CH1_V"), + PMC_ADC_VOLTAGE_CHANNEL(2, "CH2_V"), + PMC_ADC_VOLTAGE_CHANNEL(3, "CH3_V"), + PMC_ADC_VOLTAGE_CHANNEL(4, "CH4_V"), + PMC_ADC_VOLTAGE_CHANNEL(5, "CH5_V"), + PMC_ADC_VOLTAGE_CHANNEL(6, "CH6_V"), + PMC_ADC_VOLTAGE_CHANNEL(7, "CH7_V"), + PMC_ADC_VOLTAGE_CHANNEL(8, "CH8_V"), + PMC_ADC_VOLTAGE_CHANNEL(9, "CH9_V"), + PMC_ADC_VOLTAGE_CHANNEL(10, "CH10_V"), + PMC_ADC_VOLTAGE_CHANNEL(11, "CH11_V"), + PMC_ADC_VOLTAGE_CHANNEL(12, "CH12_V"), + PMC_ADC_VOLTAGE_CHANNEL(13, "CH13_V"), + PMC_ADC_VOLTAGE_CHANNEL(14, "CH14_V"), + PMC_ADC_VOLTAGE_CHANNEL(15, "CH15_V"), + + PMC_ADC_CURRENT_CHANNEL(0, "CH0_I"), + PMC_ADC_CURRENT_CHANNEL(1, "CH1_I"), + PMC_ADC_CURRENT_CHANNEL(2, "CH2_I"), + PMC_ADC_CURRENT_CHANNEL(3, "CH3_I"), + PMC_ADC_CURRENT_CHANNEL(4, "CH4_I"), + PMC_ADC_CURRENT_CHANNEL(5, "CH5_I"), + PMC_ADC_CURRENT_CHANNEL(6, "CH6_I"), + PMC_ADC_CURRENT_CHANNEL(7, "CH7_I"), + PMC_ADC_CURRENT_CHANNEL(8, "CH8_I"), + PMC_ADC_CURRENT_CHANNEL(9, "CH9_I"), + PMC_ADC_CURRENT_CHANNEL(10, "CH10_I"), + PMC_ADC_CURRENT_CHANNEL(11, "CH11_I"), + PMC_ADC_CURRENT_CHANNEL(12, "CH12_I"), + PMC_ADC_CURRENT_CHANNEL(13, "CH13_I"), + PMC_ADC_CURRENT_CHANNEL(14, "CH14_I"), + PMC_ADC_CURRENT_CHANNEL(15, "CH15_I"), +}; + +static int pmc_adc_read_raw_ch(struct pmc_adc *pmc_adc, u8 cmd, int *val) +{ + s32 ret; + + ret =3D i2c_smbus_read_word_swapped(pmc_adc->client, cmd); + if (ret < 0) { + dev_err(&pmc_adc->client->dev, "i2c read word failed (%d)\n", ret); + return ret; + } + + *val =3D sign_extend32(ret, 15); + return 0; +} + +static int pmc_adc_read_raw(struct iio_dev *indio_dev, struct iio_chan_spe= c const *chan, + int *val, int *val2, long mask) +{ + struct pmc_adc *pmc_adc =3D iio_priv(indio_dev); + int ret; + + switch (mask) { + case IIO_CHAN_INFO_PROCESSED: + /* Values are directly read in mV or mA */ + ret =3D pmc_adc_read_raw_ch(pmc_adc, chan->address, val); + if (ret) + return ret; + return IIO_VAL_INT; + } + + return -EINVAL; +} + +static int pmc_adc_fwnode_xlate(struct iio_dev *indio_dev, + const struct fwnode_reference_args *iiospec) +{ + enum iio_chan_type expected_type; + unsigned int i; + + /* + * args[0]: Acquisition type (i.e. voltage or current) + * args[1]: PMC ADC channel number + */ + if (iiospec->nargs !=3D 2) + return -EINVAL; + + switch (iiospec->args[0]) { + case GEHC_PMC_ADC_VOLTAGE: + expected_type =3D IIO_VOLTAGE; + break; + case GEHC_PMC_ADC_CURRENT: + expected_type =3D IIO_CURRENT; + break; + default: + dev_err(&indio_dev->dev, "Invalid channel type %llu\n", + iiospec->args[0]); + return -EINVAL; + } + + for (i =3D 0; i < indio_dev->num_channels; i++) + if (indio_dev->channels[i].type =3D=3D expected_type && + indio_dev->channels[i].channel =3D=3D iiospec->args[1]) + return i; + + dev_err(&indio_dev->dev, "Invalid channel type %llu number %llu\n", + iiospec->args[0], iiospec->args[1]); + return -EINVAL; +} + +static const struct iio_info pmc_adc_info =3D { + .read_raw =3D pmc_adc_read_raw, + .fwnode_xlate =3D pmc_adc_fwnode_xlate, +}; + +static const char *const pmc_adc_regulator_names[] =3D { + "vdd", + "vdda", + "vddio", + "vref", +}; + +static int pmc_adc_probe(struct i2c_client *client) +{ + struct iio_dev *indio_dev; + struct pmc_adc *pmc_adc; + struct clk *clk; + s32 val; + int ret; + + ret =3D devm_regulator_bulk_get_enable(&client->dev, ARRAY_SIZE(pmc_adc_r= egulator_names), + pmc_adc_regulator_names); + if (ret) + return dev_err_probe(&client->dev, ret, "Failed to get regulators\n"); + + clk =3D devm_clk_get_optional_enabled(&client->dev, "osc"); + if (IS_ERR(clk)) + return dev_err_probe(&client->dev, PTR_ERR(clk), "Failed to get osc cloc= k\n"); + + indio_dev =3D devm_iio_device_alloc(&client->dev, sizeof(*pmc_adc)); + if (!indio_dev) + return -ENOMEM; + + pmc_adc =3D iio_priv(indio_dev); + pmc_adc->client =3D client; + + val =3D i2c_smbus_read_byte_data(pmc_adc->client, PMC_ADC_CMD_REQUEST_PRO= TOCOL_VERSION); + if (val < 0) + return dev_err_probe(&client->dev, val, "Failed to get protocol version\= n"); + + if (val !=3D 0x01) + return dev_err_probe(&client->dev, -EINVAL, + "Unsupported protocol version 0x%02x\n", val); + + indio_dev->name =3D "pmc_adc"; + indio_dev->info =3D &pmc_adc_info; + indio_dev->channels =3D pmc_adc_channels; + indio_dev->num_channels =3D ARRAY_SIZE(pmc_adc_channels); + + return devm_iio_device_register(&client->dev, indio_dev); +} + +static const struct of_device_id pmc_adc_of_match[] =3D { + { .compatible =3D "gehc,pmc-adc"}, + { } +}; +MODULE_DEVICE_TABLE(of, pmc_adc_of_match); + +static const struct i2c_device_id pmc_adc_id_table[] =3D { + { "pmc-adc" }, + { } +}; +MODULE_DEVICE_TABLE(i2c, pmc_adc_id_table); + +static struct i2c_driver pmc_adc_i2c_driver =3D { + .driver =3D { + .name =3D "pmc-adc", + .of_match_table =3D pmc_adc_of_match, + }, + .id_table =3D pmc_adc_id_table, + .probe =3D pmc_adc_probe, +}; + +module_i2c_driver(pmc_adc_i2c_driver); + +MODULE_AUTHOR("Herve Codina "); +MODULE_DESCRIPTION("GE HealthCare PMC ADC driver"); +MODULE_LICENSE("GPL"); --=20 2.46.1 From nobody Thu Nov 28 06:45:26 2024 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 37B0516DEA7; Thu, 3 Oct 2024 11:46:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.198 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727956013; cv=none; b=J8StE1ve1BmWdXFq34p9WdrbEyRI12ak0j+IkRyhkFfCCngwNyehzOqDQfBIcPTyuSKxcmw6LQxEpeN0yc5SXhHpPApVwqetTOlC+KG13Oqiqc0vz3gS6D9iHlPkhGva0bPvL2fXyDP8L5fQ41+5ai+ckQYfzF1kMyMjc3NanVI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727956013; c=relaxed/simple; bh=xVMeWYU/7u8N+JkMqNpLyTIeMLPk0k5JmmbHLxsRXZE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AhiYcXhk3YYMdZdCX0zvogS4LWwvgpsumNu09XQgpL5btSEslp92JtRxkpcq5G+CcqXl8aNW13arLtX58cqxJey9/SqDV+YiCxNwVqj4dBYJJb9udBrT2Fhdn9K1fwqs5m6eONk4yfyP0299ra22DWyLwBjvKfZ5WSl20lsiCeE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=dnCF9Ntr; arc=none smtp.client-ip=217.70.183.198 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="dnCF9Ntr" Received: by mail.gandi.net (Postfix) with ESMTPA id 21A54C000D; Thu, 3 Oct 2024 11:46:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1727956009; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uCdCLmjll011m/jFo7l9/0Pw1jKpvpgArMBOE04lTx4=; b=dnCF9Ntrtl8ssIlvAcW1C2xEvv3ESq+Pif0PH2feKFPwNunkLtj6EAxHQrq6mAEaXvyDHQ fsHOzEnIHc4FeFmcXBJs6YxzmjZcJ3ibrsnaNAsCXLx2OY+4PepBpXosdodCeK2J/1+wt5 mavImEDi0fx9BW8/PIiN+nCJkcovofPheJ+WzhdpC9/jkly4zPnSzGNKxLmnk02rw4jHGC snQD/bua1NJttufZqLpWsuLlg39OTuNtskuR8pTN57pYgIVD9xLSTfiPXXWJ0xlDH9M72F v+ax0hzQld/pMMnxi9Kwv99jYS7VPQ4PDcD4MxXf9Fmp55BNRru8j4QDMxl6Sw== From: Herve Codina To: Herve Codina , David Lechner , Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Luca Ceresoli , Ian Ray , Thomas Petazzoni Subject: [PATCH v2 4/4] MAINTAINERS: add the GE HealthCare PMC ADC driver entry Date: Thu, 3 Oct 2024 13:46:41 +0200 Message-ID: <20241003114641.672086-5-herve.codina@bootlin.com> X-Mailer: git-send-email 2.46.1 In-Reply-To: <20241003114641.672086-1-herve.codina@bootlin.com> References: <20241003114641.672086-1-herve.codina@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-GND-Sasl: herve.codina@bootlin.com Content-Type: text/plain; charset="utf-8" After contributing the driver, add myself as the maintainer for the GE HealthCare PCM ADC IIO driver. Signed-off-by: Herve Codina Tested-by: Ian Ray --- MAINTAINERS | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index bd288a97c770..6cccbe4e3d72 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9459,6 +9459,14 @@ M: Kieran Bingham S: Supported F: scripts/gdb/ =20 +GE HEALTHCARE PMC ADC DRIVER +M: Herve Codina +L: linux-iio@vger.kernel.org +S: Maintained +F: Documentation/devicetree/bindings/iio/adc/gehc,pmc-adc.yaml +F: drivers/iio/adc/gehc-pmc-adc.c +F: include/dt-bindings/iio/adc/gehc,pmc-adc.h + GEMINI CRYPTO DRIVER M: Corentin Labbe L: linux-crypto@vger.kernel.org --=20 2.46.1