Commit 25b49a31 authored by Jonathan Cameron's avatar Jonathan Cameron
Browse files

dt-bindings:iio:adc:brcm,iproc-static-adc: txt to yaml conversion



A few questions came up in this one.
1) Why does the txt file document io-channel-ranges as a required property.
   That property is for iio-channel consumers, and this is a provider.
   I have dropped it.
2) The example had an @180a6000 for the ADC but given it uses syscon for
   all access, it doesn't have its own reg etc.  I've dropped that from
   the binding example.

Note this example was lifted directly from bcm-cygnus.dtsi so both
issues are present there as well.

Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: default avatarRob Herring <robh@kernel.org>
Cc: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
Link: https://lore.kernel.org/r/20201031184854.745828-33-jic23@kernel.org
parent 749c1e14
Loading
Loading
Loading
Loading
+0 −40
Original line number Diff line number Diff line
* Broadcom's IPROC Static ADC controller

Broadcom iProc ADC controller has 8 channels 10bit ADC.
Allows user to convert analog input voltage values to digital.

Required properties:

- compatible: Must be "brcm,iproc-static-adc"

- adc-syscon: Handler of syscon node defining physical base address of the
  controller and length of memory mapped region.

- #io-channel-cells = <1>; As ADC has multiple outputs
  refer to Documentation/devicetree/bindings/iio/iio-bindings.txt for details.

- io-channel-ranges:
  refer to Documentation/devicetree/bindings/iio/iio-bindings.txt for details.

- clocks: Clock used for this block.

- clock-names: Clock name should be given as tsc_clk.

- interrupts: interrupt line number.

For example:

	ts_adc_syscon: ts_adc_syscon@180a6000 {
		compatible = "brcm,iproc-ts-adc-syscon","syscon";
		reg = <0x180a6000 0xc30>;
	};

	adc: adc@180a6000 {
		compatible = "brcm,iproc-static-adc";
		adc-syscon = <&ts_adc_syscon>;
		#io-channel-cells = <1>;
		io-channel-ranges;
		clocks = <&asiu_clks BCM_CYGNUS_ASIU_ADC_CLK>;
		clock-names = "tsc_clk";
		interrupts = <GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>;
	};
+70 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/iio/adc/brcm,iproc-static-adc.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Broadcom's IPROC Static ADC controller

maintainers:
  - Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>

description: |
  Broadcom iProc ADC controller has 8 10bit channels

properties:
  compatible:
    const: brcm,iproc-static-adc

  adc-syscon:
    $ref: /schemas/types.yaml#/definitions/phandle
    description:
      syscon node defining physical base address of the controller and length
      of memory mapped region.

  "#io-channel-cells":
    const: 1

  clocks:
    maxItems: 1

  clock-names:
    const: tsc_clk

  interrupts:
    maxItems: 1

additionalProperties: false

required:
  - compatible
  - adc-syscon
  - "#io-channel-cells"
  - clocks
  - clock-names
  - interrupts

examples:
  - |
    #include <dt-bindings/clock/bcm-cygnus.h>
    #include <dt-bindings/interrupt-controller/arm-gic.h>
    #include <dt-bindings/interrupt-controller/irq.h>
    soc {
        #address-cells = <1>;
        #size-cells = <1>;

        ts_adc_syscon: ts_adc_syscon@180a6000 {
            compatible = "brcm,iproc-ts-adc-syscon","syscon";
            reg = <0x180a6000 0xc30>;
        };

        adc {
            compatible = "brcm,iproc-static-adc";
            adc-syscon = <&ts_adc_syscon>;
            #io-channel-cells = <1>;
            clocks = <&asiu_clks BCM_CYGNUS_ASIU_ADC_CLK>;
            clock-names = "tsc_clk";
            interrupts = <GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>;
        };
    };
...