Message ID | 20230804142820.89593-1-marius.cristea@microchip.com |
---|---|
Headers | show |
Series | Adding support for Microchip MCP3564 ADC family | expand |
On Fri, 4 Aug 2023 17:28:18 +0300 <marius.cristea@microchip.com> wrote: > From: Marius Cristea <marius.cristea@microchip.com> > > Adding support for Microchip family of 153.6 ksps, Low-Noise 16/24-Bit > Delta-Sigma ADCs with an SPI interface. This driver covers the following part > numbers: > - MCP3561, MCP3562, MCP3564, MCP3561R, MCP3562R, MCP3564R, > - MCP3461, MCP3462, MCP3464, MCP3461R, MCP3462R and MCP3464R. > > Differences related to previous patch: > v3: > - fix review comments: > - fix and update the device tree bindings > - enable "auto_zeroing_ref_enable" attribute only > when internal reference is used > - remove unused headers > - fix comments (kernel-docs) > - remove scan_type > - replace "extend_name" with read_label > - print label for each channel (label could be added into the dt) > - add comment to explain the maximum channels numbers > - add protection around critical region > - fallback compatible in device tree to deal with some newer part number > > - Open questions: > - whether or not to add a spi-mux type of thing to deal with the part number > address in case there are multiple devices connected to the same chip > select. I'd failed to register (until noticing it in a review a few mins ago) that we have have precedence for devices doing this device-address in the SPI transfer thing. The mcp3911 does it as well. Obviously that doesn't rule out us doing something different with this one though. I think we should take the view this is relatively uncommon and go with this simple vendor specific dt-binding approach. Always nice to do something more general, but sometimes it isn't worth the effort. > - discussion related to the "custom property". Last time around a consensus > wasn't reached. > > v2: > - fix review comments: > - change the device tree bindings > - change the ADC channel creation (starting from DT) > - use defines, masks and FIELD_PREP() instead of hardcoded values > - mode the PGA from Hardware Gain to scale > - add a current output channel from burnout current > - fix coding style issues > - use self-explanatory naming to drop the comment > - renumbered the versioning (start with v1 instead of v0) > > v1: > - first version committed to review > > Marius Cristea (2): > dt-bindings: iio: adc: adding MCP3564 ADC > iio: adc: adding support for MCP3564 ADC > > .../ABI/testing/sysfs-bus-iio-adc-mcp3564 | 53 + > .../bindings/iio/adc/microchip,mcp3564.yaml | 200 +++ > MAINTAINERS | 7 + > drivers/iio/adc/Kconfig | 13 + > drivers/iio/adc/Makefile | 1 + > drivers/iio/adc/mcp3564.c | 1541 +++++++++++++++++ > 6 files changed, 1815 insertions(+) > create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-adc-mcp3564 > create mode 100644 Documentation/devicetree/bindings/iio/adc/microchip,mcp3564.yaml > create mode 100644 drivers/iio/adc/mcp3564.c > > > base-commit: 9e66fb52449538406cea43e9f3889c391350e76e
On Fri, 4 Aug 2023 17:28:19 +0300 <marius.cristea@microchip.com> wrote: > From: Marius Cristea <marius.cristea@microchip.com> > > This is the device tree schema for iio driver for > Microchip family of 153.6 ksps, Low-Noise 16/24-Bit > Delta-Sigma ADCs with an SPI interface (Microchip's > MCP3461, MCP3462, MCP3464, MCP3461R, MCP3462R, > MCP3464R, MCP3561, MCP3562, MCP3564, MCP3561R, > MCP3562R and MCP3564R analog to digital converters). > > Signed-off-by: Marius Cristea <marius.cristea@microchip.com> Given driver handles the channel label binding, nice to have that in the example here. > + > +examples: > + - | > + spi { > + #address-cells = <1>; > + #size-cells = <0>; > + > + adc@0 { > + compatible = "microchip,mcp3564r"; > + reg = <0>; > + vref-supply = <&vref_reg>; > + spi-cpha; > + spi-cpol; > + spi-max-frequency = <10000000>; > + microchip,hw-device-address = <1>; > + > + #address-cells = <1>; > + #size-cells = <0>; > + > + channel@0 { > + /* CH0 to AGND */ > + reg = <0>; > + }; > + > + channel@1 { > + /* CH1 to AGND */ > + reg = <1>; > + }; > + > + /* diff-channels */ > + channel@11 { > + reg = <11>; > + > + /* CN0, CN1 */ > + diff-channels = <0 1>; > + }; > + > + channel@22 { > + reg = <0x22>; > + > + /* CN1, CN2 */ > + diff-channels = <1 2>; > + }; > + > + channel@23 { > + reg = <0x23>; > + > + /* CN1, CN3 */ > + diff-channels = <1 3>; > + }; > + }; > + }; > +...
From: Marius Cristea <marius.cristea@microchip.com> Adding support for Microchip family of 153.6 ksps, Low-Noise 16/24-Bit Delta-Sigma ADCs with an SPI interface. This driver covers the following part numbers: - MCP3561, MCP3562, MCP3564, MCP3561R, MCP3562R, MCP3564R, - MCP3461, MCP3462, MCP3464, MCP3461R, MCP3462R and MCP3464R. Differences related to previous patch: v3: - fix review comments: - fix and update the device tree bindings - enable "auto_zeroing_ref_enable" attribute only when internal reference is used - remove unused headers - fix comments (kernel-docs) - remove scan_type - replace "extend_name" with read_label - print label for each channel (label could be added into the dt) - add comment to explain the maximum channels numbers - add protection around critical region - fallback compatible in device tree to deal with some newer part number - Open questions: - whether or not to add a spi-mux type of thing to deal with the part number address in case there are multiple devices connected to the same chip select. - discussion related to the "custom property". Last time around a consensus wasn't reached. v2: - fix review comments: - change the device tree bindings - change the ADC channel creation (starting from DT) - use defines, masks and FIELD_PREP() instead of hardcoded values - mode the PGA from Hardware Gain to scale - add a current output channel from burnout current - fix coding style issues - use self-explanatory naming to drop the comment - renumbered the versioning (start with v1 instead of v0) v1: - first version committed to review Marius Cristea (2): dt-bindings: iio: adc: adding MCP3564 ADC iio: adc: adding support for MCP3564 ADC .../ABI/testing/sysfs-bus-iio-adc-mcp3564 | 53 + .../bindings/iio/adc/microchip,mcp3564.yaml | 200 +++ MAINTAINERS | 7 + drivers/iio/adc/Kconfig | 13 + drivers/iio/adc/Makefile | 1 + drivers/iio/adc/mcp3564.c | 1541 +++++++++++++++++ 6 files changed, 1815 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-adc-mcp3564 create mode 100644 Documentation/devicetree/bindings/iio/adc/microchip,mcp3564.yaml create mode 100644 drivers/iio/adc/mcp3564.c base-commit: 9e66fb52449538406cea43e9f3889c391350e76e