* [PATCH v7 0/2] drivers:iio:dac: Add AD3552R driver support
@ 2021-12-13 11:08 Mihail Chindris
2021-12-13 11:08 ` [PATCH v7 1/2] dt-bindings: iio: dac: Add adi,ad3552r.yaml Mihail Chindris
0 siblings, 1 reply; 4+ messages in thread
From: Mihail Chindris @ 2021-12-13 11:08 UTC (permalink / raw)
To: linux-kernel, linux-iio, devicetree
Cc: lars, Michael.Hennerich, jic23, nuno.sa, dragos.bogdan,
alexandru.ardelean, Mihail Chindris
Changelog v6 -> v7:
- https://lore.kernel.org/all/20211129152254.1645-1-mihail.chindris@analog.com/
- Fix yaml errors
- Fix yaml styling (blank lines and indentation)
- set adi,output-range-microvolt: true
Changelog v5 -> v6:
- https://lore.kernel.org/all/20211108082447.116663-1-mihail.chindris@analog.com/
- Add dt maintainers (forgotten on previous emails)
- (1 << 7) -> BIT(7)
- Remove buf_data from ad3552r_desc to use spi_write_then_read and update lock comment
- Remove useless comments
- Remove unused mask from ad3552r_configure_custom_gain
- In ad3552r_configure_device refactor regulator code, add regulator_enable
and add ad3552r_reg_disable
- Remove unused code like:
AD3552R_CH_TRIGGER_SOFTWARE_LDAC and AD3552R_CH_HW_LDAC_MASK
Changelog v4 -> v5:
- https://lore.kernel.org/all/20211022120427.99516-1-mihail.chindris@analog.com
- Add changelog for previous version
- Extend lock comment
- Remove unused variable is_custom
Changelog v3 -> v4:
- https://lore.kernel.org/all/20211021070924.18626-1-mihail.chindris@analog.com
- Remove trigger.h
- Use dev_err_probe only where needed
- Add comment about buff size
- Fix mutex order
- Return from all switch cases
- Return int in ad3552r_read_reg_wrapper
- Add goto put_child where missing
- Restructure ad3552r_write_codes
- Move ad3552r_write_codes nex to ad3552r_trigger_handler
- Use memcpy and memcmp in ad3552r_write_codes
- Remove endieness functions in ad3552r_write_codes
Changelog v2 -> v3:
- https://lore.kernel.org/all/20211008123909.1901-1-mihail.chindris@analog.com
- Order compatilbe in alphabetic order
- Fix comments in yaml
- Grup struct by types
- Drop usless "if (err)"
- Handle error in ad3552r_read_reg_wrapper
- ad3552r_find_range: u32 -> s32
- Add fwnode_handle_put(custom_gain_child); in good path too
- Vals[0] -> val
- Fix: fwnode_handle_put in ad3552r_configure_device
- Fix indio_dev->name
- Rename custom_gain_child -> gain_child
- Remove intermediary functions and write code inline where possible
- Add ad3552r_field_prep helper function
- Dev_err -> dev_warn for vref supply check
- Replace dev_err with dev_err_probe
- Remove channel for simultaneous update and do update mask register if both
channels values are the same.
Changelog v0 -> v2:
- Split https://lore.kernel.org/all/20210820165927.4524-1-mihail.chindris@analog.com
and move ad3552r driver to this serie.
- Remove precision_mode abi
- Remove adi,synch_channels dt property
- Use vref-supply instead of adi,vref-select
- Remove unimplemented spi modes
- Change output-range format and use enums
- Update description for custom-output-range-config to be more clear
- Add datasheet tag
- Use GENMASK for defines
- Remove tomicro define
- Use get_unaligned_be16 and put_unaligned_be16
- Remove unnecessary checks
- Add comment for AD3552R_CH_DAC_PAGE channel
- Fix indent
- Remove irq trigger
- Remove irelevant checks
- Rename ad3552r_read_reg_pool to ad3552r_read_reg_wrapper.
- Add support for ad3542r
V0:
* Add ad3552r example to https://lore.kernel.org/linux-iio/20210219124012.92897-1-alexandru.ardelean@analog.com
Mihail Chindris (2):
dt-bindings: iio: dac: Add adi,ad3552r.yaml
drivers:iio:dac: Add AD3552R driver support
.../bindings/iio/dac/adi,ad3552r.yaml | 217 ++++
drivers/iio/dac/Kconfig | 10 +
drivers/iio/dac/Makefile | 1 +
drivers/iio/dac/ad3552r.c | 1138 +++++++++++++++++
4 files changed, 1366 insertions(+)
create mode 100644 Documentation/devicetree/bindings/iio/dac/adi,ad3552r.yaml
create mode 100644 drivers/iio/dac/ad3552r.c
base-commit: 29adf99733e95621dfbebaf9ae548b4da8316aaf
--
2.27.0
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH v7 1/2] dt-bindings: iio: dac: Add adi,ad3552r.yaml 2021-12-13 11:08 [PATCH v7 0/2] drivers:iio:dac: Add AD3552R driver support Mihail Chindris @ 2021-12-13 11:08 ` Mihail Chindris 2021-12-14 16:15 ` Rob Herring 2021-12-16 17:57 ` Jonathan Cameron 0 siblings, 2 replies; 4+ messages in thread From: Mihail Chindris @ 2021-12-13 11:08 UTC (permalink / raw) To: linux-kernel, linux-iio, devicetree Cc: lars, Michael.Hennerich, jic23, nuno.sa, dragos.bogdan, alexandru.ardelean, Mihail Chindris Add documentation for ad3552r and ad3542r Signed-off-by: Mihail Chindris <mihail.chindris@analog.com> --- .../bindings/iio/dac/adi,ad3552r.yaml | 217 ++++++++++++++++++ 1 file changed, 217 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/dac/adi,ad3552r.yaml diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad3552r.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad3552r.yaml new file mode 100644 index 000000000000..f11d473840e0 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/dac/adi,ad3552r.yaml @@ -0,0 +1,217 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +# Copyright 2020 Analog Devices Inc. +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/dac/adi,ad3552r.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Analog Devices AD2552R DAC device driver + +maintainers: + - Mihail Chindris <mihail.chindris@analog.com> + +description: | + Bindings for the Analog Devices AD3552R DAC device and similar. + Datasheet can be found here: + https://www.analog.com/media/en/technical-documentation/data-sheets/ad3542r.pdf + https://www.analog.com/media/en/technical-documentation/data-sheets/ad3552r.pdf + +properties: + compatible: + enum: + - adi,ad3542r + - adi,ad3552r + + reg: + maxItems: 1 + + spi-max-frequency: + maximum: 30000000 + + reset-gpios: + maxItems: 1 + + ldac-gpios: + description: | + LDAC pin to be used as a hardware trigger to update the DAC channels. + maxItems: 1 + + vref-supply: + description: + The regulator to use as an external reference. If it does not exists the + internal reference will be used. External reference must be 2.5V + + adi,vref-out-en: + description: Vref I/O driven by internal vref to 2.5V. If not set, Vref pin + will be floating. + type: boolean + + adi,sdo-drive-strength: + description: | + Configure SDIO0 and SDIO1 strength levels: + - 0: low SDO drive strength. + - 1: medium low SDO drive strength. + - 2: medium high SDO drive strength. + - 3: high SDO drive strength + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1, 2, 3] + + '#address-cells': + const: 1 + + '#size-cells': + const: 0 + +patternProperties: + "^channel@([0-1])$": + type: object + description: Configurations of the DAC Channels + + additionalProperties: false + + properties: + reg: + description: Channel number + enum: [0, 1] + + adi,output-range-microvolt: true + + custom-output-range-config: + type: object + description: Configuration of custom range when + adi,output-range-microvolt is not present. + The formulas for calculation the output voltages are + Vout_fs = 2.5 + [(GainN + Offset/1024) * 2.5 * Rfbx * 1.03] + Vout_zs = 2.5 - [(GainP + Offset/1024) * 2.5 * Rfbx * 1.03] + + properties: + adi,gain-offset: + description: Gain offset used in the above formula + $ref: /schemas/types.yaml#/definitions/int32 + maximum: 511 + minimum: -511 + + adi,gain-scaling-p-inv-log2: + description: GainP = 1 / ( 2 ^ adi,gain-scaling-p-inv-log2) + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1, 2, 3] + + adi,gain-scaling-n-inv-log2: + description: GainN = 1 / ( 2 ^ adi,gain-scaling-n-inv-log2) + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1, 2, 3] + + adi,rfb-ohms: + description: Feedback Resistor + + required: + - adi,gain-offset + - adi,gain-scaling-p-inv-log2 + - adi,gain-scaling-n-inv-log2 + - adi,rfb-ohms + + required: + - reg + + oneOf: + # If adi,output-range-microvolt is missing, + # custom-output-range-config must be used + - required: + - adi,output-range-microvolt + + - required: + - custom-output-range-config + +allOf: + - if: + properties: + compatible: + contains: + const: adi,ad3542r + then: + patternProperties: + "^channel@([0-1])$": + type: object + properties: + adi,output-range-microvolt: + description: | + Voltage output range of the channel as <minimum, maximum> + Required connections: + Rfb1x for: 0 to 2.5 V; 0 to 3V; 0 to 5 V; + Rfb2x for: 0 to 10 V; 2.5 to 7.5V; -5 to 5 V; + oneOf: + - items: + - const: 0 + - enum: [2500000, 3000000, 5000000, 10000000] + - items: + - const: -2500000 + - const: 7500000 + - items: + - const: -5000000 + - const: 5000000 + + required: + - adi,output-range-microvolt + + - if: + properties: + compatible: + contains: + const: adi,ad3552r + then: + patternProperties: + "^channel@([0-1])$": + type: object + properties: + adi,output-range-microvolt: + description: | + Voltage output range of the channel as <minimum, maximum> + Required connections: + Rfb1x for: 0 to 2.5 V; 0 to 5 V; + Rfb2x for: 0 to 10 V; -5 to 5 V; + Rfb4x for: -10 to 10V + oneOf: + - items: + - const: 0 + - enum: [2500000, 5000000, 10000000] + - items: + - const: -5000000 + - const: 5000000 + - items: + - const: -10000000 + - const: 10000000 + +required: + - compatible + - reg + - spi-max-frequency + +additionalProperties: false + +examples: + - | + spi { + #address-cells = <1>; + #size-cells = <0>; + ad3552r@0 { + compatible = "adi,ad3552r"; + reg = <0>; + spi-max-frequency = <20000000>; + #address-cells = <1>; + #size-cells = <0>; + channel@0 { + reg = <0>; + adi,output-range-microvolt = <0 10000000>; + }; + channel@1 { + reg = <1>; + custom-output-range-config { + adi,gain-offset = <5>; + adi,gain-scaling-p-inv-log2 = <1>; + adi,gain-scaling-n-inv-log2 = <2>; + adi,rfb-ohms = <1>; + }; + }; + }; + }; +... -- 2.27.0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v7 1/2] dt-bindings: iio: dac: Add adi,ad3552r.yaml 2021-12-13 11:08 ` [PATCH v7 1/2] dt-bindings: iio: dac: Add adi,ad3552r.yaml Mihail Chindris @ 2021-12-14 16:15 ` Rob Herring 2021-12-16 17:57 ` Jonathan Cameron 1 sibling, 0 replies; 4+ messages in thread From: Rob Herring @ 2021-12-14 16:15 UTC (permalink / raw) To: Mihail Chindris Cc: linux-iio, linux-kernel, alexandru.ardelean, jic23, devicetree, nuno.sa, Michael.Hennerich, lars, dragos.bogdan On Mon, 13 Dec 2021 11:08:24 +0000, Mihail Chindris wrote: > Add documentation for ad3552r and ad3542r > > Signed-off-by: Mihail Chindris <mihail.chindris@analog.com> > --- > .../bindings/iio/dac/adi,ad3552r.yaml | 217 ++++++++++++++++++ > 1 file changed, 217 insertions(+) > create mode 100644 Documentation/devicetree/bindings/iio/dac/adi,ad3552r.yaml > Reviewed-by: Rob Herring <robh@kernel.org> ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v7 1/2] dt-bindings: iio: dac: Add adi,ad3552r.yaml 2021-12-13 11:08 ` [PATCH v7 1/2] dt-bindings: iio: dac: Add adi,ad3552r.yaml Mihail Chindris 2021-12-14 16:15 ` Rob Herring @ 2021-12-16 17:57 ` Jonathan Cameron 1 sibling, 0 replies; 4+ messages in thread From: Jonathan Cameron @ 2021-12-16 17:57 UTC (permalink / raw) To: Mihail Chindris Cc: linux-kernel, linux-iio, devicetree, lars, Michael.Hennerich, nuno.sa, dragos.bogdan, alexandru.ardelean On Mon, 13 Dec 2021 11:08:24 +0000 Mihail Chindris <mihail.chindris@analog.com> wrote: > Add documentation for ad3552r and ad3542r > > Signed-off-by: Mihail Chindris <mihail.chindris@analog.com> > +patternProperties: > + "^channel@([0-1])$": > + type: object > + description: Configurations of the DAC Channels > + > + additionalProperties: false > + spaces on line above. Fixed whilst applying. > + properties: > + reg: > + description: Channel number > + enum: [0, 1] > + ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-12-16 17:52 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-12-13 11:08 [PATCH v7 0/2] drivers:iio:dac: Add AD3552R driver support Mihail Chindris 2021-12-13 11:08 ` [PATCH v7 1/2] dt-bindings: iio: dac: Add adi,ad3552r.yaml Mihail Chindris 2021-12-14 16:15 ` Rob Herring 2021-12-16 17:57 ` Jonathan Cameron
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).