Device tree changes to support ADC (AD7192)

I am trying to use an AD7192 by utilizing the new Industrial IO (IIO) drivers with a beaglebone black (BBB). This is what I have done.

  1. I have checked the IIO subsystem is compiled as a kernel module
  2. I have checked the AD7192 is compiled as a kernel module (it is in the staging section)
  3. I understand that I need to modify the device tree. So I have started with the DTS file below, but I am having trouble finishing it.

I get that I need to turn on the SPI bus (SPI1 in this case). I only need the default CS 0 (so I am not using a GPIO pin for chip select). I also want to use the data ready RDY function of the AD7192, so the DOUT pin is also wired to the GPIO3_19. This pin needs to edge triggered interrupt to allow the BBB to collect data from the ADC.

So far so good. I mark out the pins I am using, and I enable the spi port that I am using. Where I am running in to trouble is specifying the adc is the thing connected to CS0 of the SPI port.

Have I specified that correctly?
ow do I bind this SPI device to the ad7192 driver?

The ADC drivers in industrial IO don’t seem to support device tree entirely in the 3.8 version of the kernel.

How do I tell it that GPIO3_19 is to be the interrupt for the AD7192?

On linux 3.2 of the old beaglebone, I could just do this in the board file.

static struct ad7192_platform_data ad7192_pdata = {
.vref_mv = 3300,
.clock_source_sel = 2,
.refin2_en = true,
.rej60_en = false,
.sinc3_en = false,
.chop_en = false,
.buf_en = false,
.unipolar_en = true,
.burnout_curr_en = false,
};

static struct spi_board_info ad7192_support[] = {
{
.modalias = “ad7192”,
.irq = -1,
// OK-S - slow down the clock from
// 12 MHz to 2 M
.max_speed_hz = 1000000,
.bus_num = 2,
.chip_select = 1,
// OK-S I think we want to have the clock start high
// CPOL = 1
// I think we want to sample on the trailling edge
// CPHA = 1
// SPI_MODE_3 = (SPI_CPOL|SPI_CPHA)
.mode = SPI_MODE_3,
.platform_data = &ad7192_pdata,
},
};
and registering ad7192_support with a call to
ad7192_support[0].irq = gpio_to_irq(GPIO_TO_PIN(3, 19));
spi_register_board_info(ad7192_support, ARRAY_SIZE(ad7192_support));

to patch up the interrupt and get the board to understand that there is an ADC on the SPI bus.

Here is the start of my dts file. Any suggestions would be most appreciated.

/*

  • Copyright © 2013 Elemental Semiconductor
  • Copyright © 2013 Texas Instruments

It appears no one knows how to do this yet. A simpler question would be:

Does anyone know how to specify a gpio as an interrupt in device tree?

For example is this the correct way to assign the gpio3_19 as the interrupt used by the AD7192 when it is hooked up to the SPI bus 1?

/*

  • Copyright © 2013 Elemental Semiconductor
  • Copyright © 2013 Texas Instruments