AD7606 probe function not getting called

Hi Team ,
I am trying to add support to an "Analog SPI device AD7606" from device tree
so that the driver's "drivers/staging/iio/adc/ad7606_spi.c"
probe function is called ( Apalis iMX6 + IXORA )

Enabled the spi device in arch/arm/boot/dts/imx6qdl-apalis-ixora.dtsi to get
/* Apalis SPI1 */
&ecspi1 {
         status = "okay";
         spidev0: spidev@1 {
               compatible = "toradex,evalspi";
               reg = <0>;
               spi-max-frequency = <18000000>;
            };

              ad7606-8@2 {
                  compatible = "adi,ad7606-8","adi,ad7606-4","adi,ad7606-4";
                   reg = <0>;
                    spi-max-frequency = <18000000>;
               };
};

The drive r code to bind the device is
static const struct spi_device_id ad7606_id[] = {
      {"ad7606-8", ID_AD7606_8},
      {"ad7606-6", ID_AD7606_6},
      {"ad7606-4", ID_AD7606_4},
      {}
};
MODULE_DEVICE_TABLE(spi, ad7606_id);

static struct spi_driver ad7606_driver = {
      .driver = {
            .name = "ad7606",
            .owner = THIS_MODULE,
           .pm = AD7606_SPI_PM_OPS,
      },
      .probe = ad7606_spi_probe,
      .remove = ad7606_spi_remove,
      .id_table = ad7606_id,
};

module_spi_driver(ad7606_driver);

Could team please let me know what might be the problem here or if team can please provide any pointers.

  • Hi,

    Do you get any error messages in your boot log?

    There is one issue with your declaration, you have two SPI devices for the same SPI master which both use the same chip-select. This will not work. The 'reg' property must match the chip-select signal that the device is connected to.

    Another thing, the compatible string should match the device that is connected to the device on your board. Not all of the devices supported by the driver.

  • Dear larsc ,
    1) Will change the reg value and check again.

    2) I am following the steps mentioned here AD7606 IIO Multi-Channel Simultaneous Sampling ADC Linux Driver [Analog Devices Wiki] 

    Here i am unable to understand which file should i refer to add support for :-
    1) static struct spi_board_info board_spi_board_info[] followed by function call to spi_register_board_info()

    2) Add an platform_device structure

    Please note that we are using Toradex apalis imx6 board which doesn't have any a board_xxx file in e.g. arch/arm/mach-imx.

    Currently we are struggling to get the probe function of ad7606 driver being called .

    Could you please provide some pointer .

     

  • The board, no matter which one, needs to have a device tree file somewhere. We don't know what the name is, or where your Linux vendor put it - you would need to ask them - not us. 


    Can you check with Freescale?


    - Robin

  • Hi,

    What the documentation describes is using board files built into the kernel. Your system is using devicetree, which is a different way of describing the peripherals connected in the system. Your devicetree entry looks mostly good expect for the parts I mentioned above.

    - Lars

  • Dear Larsc / Rgetz ,

    1) Got the probe function called properly by making the changes , as per input from Larsc. 

    This was done by following changes in the arch/arm/boot/dts/imx6qdl-apalis-ixora.dtsi file :-

    &ecspi1 { status = "okay";

    /*  spidev0: spidev@1 {         

          compatible = "toradex,evalspi";         

          reg = <0>;         

          spi-max-frequency = <18000000>; */    

    };          

          adcc7606-8@0 {         

             compatible = "adi,adcc7606-8";         

             reg = <0>;         

             spi-max-frequency = <18000000>;     

          }; 

    };

    2) Now i was looking at how to pass the required values of ( sample)  to the driver. 

                            .default_os = 0,     

                            .default_range = 10000,     

                            .gpio_convst = GPIO_PF9,     

                            .gpio_reset = GPIO_PF10,     

                            .gpio_range = GPIO_PH0,     

                            .gpio_os0 = GPIO_PH1,     

                            .gpio_os1 = GPIO_PH2,     

                            .gpio_os2 = GPIO_PH3,     

                            .gpio_frstdata = -1,     

                            .gpio_stby = GPIO_PF12,

    Currently i am looking to try somethig like :-

    adcc7606-8@0 {
                            compatible = "adi,adcc7606-8";
                            reg = <0x0>;
                            spi-max-frequency = <0x112a880>;
                            default_os = <0x0>;
                            default_range = <0x2710>;
                            gpio_convst = <REQUIRED-VALUE>;
                            gpio_reset = <REQUIORED-VALUE>;
                             << Similarly other required values >>
    };

    Could team please let me know if this is correct approach / way of passing the values to the drivers or can you please 

    provide some pointers on the same.