Post Go back to editing

Cannot access AD74412 from userspace

Category: Software
Product Number: AD74412R
Software Version: Linux kernel 5.15

I am attempting to get first time access to my AD74412 on an i.MX8 variant hardware. I have added the AD74412 to the device tree but the AD74412 is not available under /sys/bus/iio/devices. Is there a problem with my device tree configuration or is there something else going wrong?

I am using kernel version 5.15. Here are some relevant device tree section for the SPI port and the attached AD74412 in my code:

    regulators {
        compatible = "simple-bus";
        #address-cells = <1>;
        #size-cells = <0>;

...

        ad74412_refin: regulator@7 {
            compatible = "regulator-fixed";
            reg = <7>;
            regulator-name = "ad74412_refin";
            regulator-min-microvolt = <2500000>;
            regulator-max-microvolt = <2500000>;
            enable-active-high;
            regulator-always-on;
        };

    };

...


&ecspi3 {
    #address-cells = <1>;
    #size-cells = <0>;
    num-cs = <1>;
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_ecspi3>;

    cs-gpios = <&gpio5 25 GPIO_ACTIVE_LOW>;
    status = "okay";

    ad74412:ad74412@0 {
        compatible = "adi,ad74412r";
        reg = <0>;

        #address-cells = <1>;
        #size-cells = <0>;

        spi-max-frequency = <1000000>;
        spi-cpol;

        refin-supply = <&ad74412_refin>;

        status = "okay";

        channel@0 {
            reg = <0>;
            adi,ch-func = <CH_FUNC_VOLTAGE_OUTPUT>;
        };

        channel@1 {
            reg = <1>;
            adi,ch-func = <CH_FUNC_VOLTAGE_OUTPUT>;
        };

        channel@2 {
            reg = <2>;
            adi,ch-func = <CH_FUNC_VOLTAGE_OUTPUT>;
        };

        channel@3 {
            reg = <3>;
            adi,ch-func = <CH_FUNC_VOLTAGE_OUTPUT>;
        };
    };
};

I see the ad74412 device tree configuration in the /proc/device-tree, but the ad74412 does not show up under /sys/bus/iio/devices section. Did I miss something in the device tree configuration, or is there something else I may have missed?

Parents
  • Hi,

    Do you see any message on the dmesg regarding your device? I would start by making sure it's probing and if so, it is failing at some point...

    - Nuno Sá

  • I found these two lines in dmesg:

    [    2.141050] ad74413r spi2.0: error -EINVAL: Failed to request irq
    [    2.147167] ad74413r: probe of spi2.0 failed with error -22

    I'm assuming the probe is attempting to request an irq for the SPI port chip select. I've verified that the specified chip select pin matches the correct pin on my hardware. I also have verified that the chip select pin is not being used by anything else. Any ideas of what else to verify?

Reply
  • I found these two lines in dmesg:

    [    2.141050] ad74413r spi2.0: error -EINVAL: Failed to request irq
    [    2.147167] ad74413r: probe of spi2.0 failed with error -22

    I'm assuming the probe is attempting to request an irq for the SPI port chip select. I've verified that the specified chip select pin matches the correct pin on my hardware. I also have verified that the chip select pin is not being used by anything else. Any ideas of what else to verify?

Children