Skip to contentSkip to conversation

ad7793 adc rcv userspace test - details attached

DISCUSSION malas 2 participants 7 messages Aug 24, 2011 – Aug 30, 2011 IIO

lore
Share & tools
lore

malas

author
#0 lore raw

Dear Michael Hennerich,

I have attached the details of my testing with the ad7793 driver both as when installed as module and otherwise.

I have not been to resolve the issue even after having created a device node under /dev as device0:buffer0.

Requesting your further assistance for the same.

Thanks
Mala

--
Open WebMail Project (http://openwebmail.org)

#1 lore raw
Quoted 34 lines · malas

Dear Michael Hennerich,

I have attached the details of my testing with the ad7793 driver both as when installed as module and otherwise.

I have not been to resolve the issue even after having created a device node under /dev as device0:buffer0.

Requesting your further assistance for the same.

Thanks
Mala

--
Open WebMail Project (http://openwebmail.org)

Testing results of ADC ad7793 driver with generic_buffer.c

Results of installing ad7793 adc driver as module:

root:/> cd lib/modules/3.1.0-rc1-dirty/kernel/drivers/staging/iio/adc/ root:/lib/modules/3.1.0-rc1-dirty/kernel/drivers/staging/iio/adc> ls ad7793.ko root:/lib/modules/3.1.0-rc1-dirty/kernel/drivers/staging/iio/adc> insmod ad7793. ko
ad7793: module is from the staging directory, the quality is unknown, you have been warned. root:/lib/modules/3.1.0-rc1-dirty/kernel/drivers/staging/iio/adc> lsmod

Module                  Size  Used by 
ad7793                  7998  0 
Quoted 8 lines

root:/lib/modules/3.1.0-rc1-dirty/kernel/drivers/staging/iio/adc> cd root:/> ls -l /dev/device0\:buffer0
crw-r--r-- 1 root root 0, 0 Jan 1 00:00 /dev/device0:buffer0
root:/> ls /sys/bus/iio/devices/
iio_sysfs_trigger
root:/>

I observed driver probe() doesn't get called when inserted as module. Also the device0\buffer0 nodes dont get created on installation.

If probe isn't getting called then something has gone wrong in device matching. What is the board file you are using? (guessing blackfin hasn't gone all device tree yet?)

Quoted 7 lines

Results of installing ad7793 adc driver built into kernel:

I added following line in .rc under dist/vendor/AnalogDevices/common/.

mknod /dev/device0:buffer0 c 0 0

Please confirm this property of node is correct?

No it isn't.
http://www.kernel.org/pub/linux/docs/device-list/devices-2.6+.txt
tells us that 0 0 is reserved for null devices.

What does the following contain?

/sys/bus/iio/devices/device0:/buffer0/dev

author
#2 lore raw

On Wed, 24 Aug 2011 09:44:00 +0100, Jonathan Cameron wrote

Quoted 26 lines · malas
Quoted 25 lines

Dear Michael Hennerich,

I have attached the details of my testing with the ad7793 driver both as when installed as module and otherwise.

I have not been to resolve the issue even after having created a device node under /dev as device0:buffer0.

Requesting your further assistance for the same.

Thanks
Mala

--
Open WebMail Project (http://openwebmail.org)

Testing results of ADC ad7793 driver with generic_buffer.c

Quoted 6 lines
Quoted 6 lines

Results of installing ad7793 adc driver as module:

root:/> cd lib/modules/3.1.0-rc1-dirty/kernel/drivers/staging/iio/adc/ root:/lib/modules/3.1.0-rc1-dirty/kernel/drivers/staging/iio/adc> ls ad7793.ko root:/lib/modules/3.1.0-rc1-dirty/kernel/drivers/staging/iio/adc> insmod ad7793. ko
ad7793: module is from the staging directory, the quality is unknown, you have been

warned.

Quoted 11 lines
Quoted 11 lines

root:/lib/modules/3.1.0-rc1-dirty/kernel/drivers/staging/iio/adc> lsmod

Module                  Size  Used by 
ad7793                  7998  0 

root:/lib/modules/3.1.0-rc1-dirty/kernel/drivers/staging/iio/adc> cd root:/> ls -l /dev/device0\:buffer0
crw-r--r-- 1 root root 0, 0 Jan 1 00:00 /dev/device0:buffer0
root:/> ls /sys/bus/iio/devices/
iio_sysfs_trigger
root:/>

I observed driver probe() doesn't get called when inserted as module. Also the

device0\buffer0 nodes dont get created on installation.

Quoted 4 lines

If probe isn't getting called then something has gone wrong in device matching. What is the board file you are using? (guessing blackfin hasn't gone all device tree yet?)

board file and driver has name and modalias as ad7793 (small case)

Quoted 5 lines
Quoted 5 lines

Results of installing ad7793 adc driver built into kernel:

I added following line in .rc under dist/vendor/AnalogDevices/common/.

Quoted 7 lines
Quoted 3 lines

mknod /dev/device0:buffer0 c 0 0

Please confirm this property of node is correct?

No it isn't.
http://www.kernel.org/pub/linux/docs/device-list/devices-2.6+.txt
tells us that 0 0 is reserved for null devices.

iio major number listed under/proc/devices for iio was 254
What major and minor number should I initialize for the /dev/devicw0buffer0 device node.

Quoted 3 lines

What does the following contain?

/sys/bus/iio/devices/device0:/buffer0/dev

It has ad7793-dev
--
Open WebMail Project (http://openwebmail.org)

#3 lore raw
Quoted 61 lines · malas

On Wed, 24 Aug 2011 09:44:00 +0100, Jonathan Cameron wrote

Quoted 26 lines · malas
Quoted 25 lines

Dear Michael Hennerich,

I have attached the details of my testing with the ad7793 driver both as when installed as module and otherwise.

I have not been to resolve the issue even after having created a device node under /dev as device0:buffer0.

Requesting your further assistance for the same.

Thanks
Mala

--
Open WebMail Project (http://openwebmail.org)

Testing results of ADC ad7793 driver with generic_buffer.c

Quoted 6 lines
Quoted 6 lines

Results of installing ad7793 adc driver as module:

root:/> cd lib/modules/3.1.0-rc1-dirty/kernel/drivers/staging/iio/adc/ root:/lib/modules/3.1.0-rc1-dirty/kernel/drivers/staging/iio/adc> ls ad7793.ko root:/lib/modules/3.1.0-rc1-dirty/kernel/drivers/staging/iio/adc> insmod ad7793. ko
ad7793: module is from the staging directory, the quality is unknown, you have been

warned.

Quoted 11 lines
Quoted 11 lines

root:/lib/modules/3.1.0-rc1-dirty/kernel/drivers/staging/iio/adc> lsmod

Module                  Size  Used by 
ad7793                  7998  0 

root:/lib/modules/3.1.0-rc1-dirty/kernel/drivers/staging/iio/adc> cd root:/> ls -l /dev/device0\:buffer0
crw-r--r-- 1 root root 0, 0 Jan 1 00:00 /dev/device0:buffer0
root:/> ls /sys/bus/iio/devices/
iio_sysfs_trigger
root:/>

I observed driver probe() doesn't get called when inserted as module. Also the

device0\buffer0 nodes dont get created on installation.

Quoted 4 lines

If probe isn't getting called then something has gone wrong in device matching. What is the board file you are using? (guessing blackfin hasn't gone all device tree yet?)

board file and driver has name and modalias as ad7793 (small case)

Quoted 7 lines
Quoted 7 lines

Results of installing ad7793 adc driver built into kernel:

I added following line in .rc under dist/vendor/AnalogDevices/common/.

mknod /dev/device0:buffer0 c 0 0

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Please confirm this property of node is correct?

No it isn't.
http://www.kernel.org/pub/linux/docs/device-list/devices-2.6+.txt
tells us that 0 0 is reserved for null devices.

iio major number listed under/proc/devices for iio was 254
What major and minor number should I initialize for the /dev/devicw0buffer0 device node.

Major as you've noted is 255

Quoted 7 lines
Quoted 5 lines

What does the following contain?

/sys/bus/iio/devices/device0:/buffer0/dev

It has ad7793-dev

really? Should be a major:minor number pair.

Quoted 6 lines

--
Open WebMail Project (http://openwebmail.org)

author
#4 lore raw

On Wed, 24 Aug 2011 16:51:11 +0100, Jonathan Cameron wrote

Quoted 7 lines · malas
Quoted 6 lines

On Wed, 24 Aug 2011 09:44:00 +0100, Jonathan Cameron wrote

Quoted 5 lines · malas
Quoted 4 lines

Dear Michael Hennerich,

I have attached the details of my testing with the ad7793 driver both as when

installed

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

as module and otherwise.

I have not been to resolve the issue even after having created a device node under

/dev

Quoted 52 lines
Quoted 52 lines
Quoted 18 lines
Quoted 18 lines

as device0:buffer0.

Requesting your further assistance for the same.

Thanks
Mala

--
Open WebMail Project (http://openwebmail.org)

Testing results of ADC ad7793 driver with generic_buffer.c

Quoted 6 lines
Quoted 6 lines

Results of installing ad7793 adc driver as module:

root:/> cd lib/modules/3.1.0-rc1-dirty/kernel/drivers/staging/iio/adc/ root:/lib/modules/3.1.0-rc1-dirty/kernel/drivers/staging/iio/adc> ls ad7793.ko root:/lib/modules/3.1.0-rc1-dirty/kernel/drivers/staging/iio/adc> insmod ad7793. ko
ad7793: module is from the staging directory, the quality is unknown, you have been

warned.

Quoted 11 lines
Quoted 11 lines

root:/lib/modules/3.1.0-rc1-dirty/kernel/drivers/staging/iio/adc> lsmod

Module                  Size  Used by 
ad7793                  7998  0 

root:/lib/modules/3.1.0-rc1-dirty/kernel/drivers/staging/iio/adc> cd root:/> ls -l /dev/device0\:buffer0
crw-r--r-- 1 root root 0, 0 Jan 1 00:00 /dev/device0:buffer0
root:/> ls /sys/bus/iio/devices/
iio_sysfs_trigger
root:/>

I observed driver probe() doesn't get called when inserted as module. Also the

device0\buffer0 nodes dont get created on installation.

Quoted 4 lines

If probe isn't getting called then something has gone wrong in device matching. What is the board file you are using? (guessing blackfin hasn't gone all device tree yet?)

board file and driver has name and modalias as ad7793 (small case)

Quoted 7 lines
Quoted 7 lines

Results of installing ad7793 adc driver built into kernel:

I added following line in .rc under dist/vendor/AnalogDevices/common/.

mknod /dev/device0:buffer0 c 0 0

Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Please confirm this property of node is correct?

No it isn't.
http://www.kernel.org/pub/linux/docs/device-list/devices-2.6+.txt
tells us that 0 0 is reserved for null devices.

iio major number listed under/proc/devices for iio was 254
What major and minor number should I initialize for the /dev/devicw0buffer0 device

node.

Quoted 9 lines

Major as you've noted is 255

Quoted 7 lines
Quoted 5 lines

What does the following contain?

/sys/bus/iio/devices/device0:/buffer0/dev

It has ad7793-dev

really? Should be a major:minor number pair.

Sorry, that was trigger name. Under /dev, as you say,

Yes Jonanthan. /dev has major:minor = 254:0.

Open() call now succeeds. Poll waits indefinitely. I have to check out if "data ready" signalling GPIO interrupt gets enabled and ring buffer getting filled or not.I shall test further and get back.

Thanks Jonanthan.

Quoted 6 lines
Quoted 6 lines

--
Open WebMail Project (http://openwebmail.org)

--
Open WebMail Project (http://openwebmail.org)

author
#5 lore raw

ad7793 adc rcv userspace test - passed succesfully

In reply to Jonathan Cameron

Dear Jonathan Cameron,

I last reported that after creating device node and opening it, read() call was failing. I got to fix this.

The reason was this:
4 functions are exported from ad7793 module to iio-ring module as ring setup ops:
namely:
.preenable = &ad7793_ring_preenable,
.postenable = &iio_triggered_ring_postenable,
.predisable = &iio_triggered_ring_predisable,
.postdisable = &ad7793_ring_postdisable,

In the iio-ring modules "iio_store_ring_enable" function is invoked from user app,which inturn invokes the func "ad7793_ring_preenable" and subsequently driver's postenable function.

The "iio_triggered_ring_postenable" function then attaches the poll function to the ring trigger soft interrupt.

Since continuous mode was set and enabled the configured GPIO interrupt for capturing data ready signal (in ad7793_ring_preenable) as interrupt, iio_trigger_poll() invoked on interrupt (from drivers data rdy interrupt handler) failed to raise soft interrupt and as a consequence driver's ad7793_trigger_handler() was not invoked when data ready.

I patched as follows in ad7793.c:

1. Moved irq enabling from ad7793_ring_preenable to ad7793_ring_postenable
2. Defined ad7793_ring_setup_ops ".postenable" as ad7793_ring_postenable
3. In ad7793_ring_postenable, invoked &iio_triggered_ring_postenable and then enabled the data ready signalling GPIO interrupt.

Then, from user app after opening the device, Poll() for rcv data presence was successful and read() call returned non-zero size . Could print the data from ring buffer.

Sincere thanks to you and Michael for guiding me through.

Take care.

regards
Mala

#6 lore raw

Re: ad7793 adc rcv userspace test - passed succesfully

Quoted 26 lines · malas

Dear Jonathan Cameron,

I last reported that after creating device node and opening it, read() call was failing. I got to fix this.

The reason was this:
4 functions are exported from ad7793 module to iio-ring module as ring setup ops:
namely:
.preenable = &ad7793_ring_preenable,
.postenable = &iio_triggered_ring_postenable,
.predisable = &iio_triggered_ring_predisable,
.postdisable = &ad7793_ring_postdisable,

In the iio-ring modules "iio_store_ring_enable" function is invoked from user app,which inturn invokes the func "ad7793_ring_preenable" and subsequently driver's postenable function.

The "iio_triggered_ring_postenable" function then attaches the poll function to the ring trigger soft interrupt.

Since continuous mode was set and enabled the configured GPIO interrupt for capturing data ready signal (in ad7793_ring_preenable) as interrupt, iio_trigger_poll() invoked on interrupt (from drivers data rdy interrupt handler) failed to raise soft interrupt and as a consequence driver's ad7793_trigger_handler() was not invoked when data ready.

Quoted 6 lines

I patched as follows in ad7793.c:

1. Moved irq enabling from ad7793_ring_preenable to ad7793_ring_postenable
2. Defined ad7793_ring_setup_ops ".postenable" as ad7793_ring_postenable
3. In ad7793_ring_postenable, invoked &iio_triggered_ring_postenable and then enabled the data ready signalling GPIO interrupt.

Hmm.. That will fix the issue. Normally I'd expect to see the enable actually happening in the trigger_set_state callback rather than there, but this device shares the interrupt line with on of the spi signal lines so is messing with irq's a lot more than normal so I guess that doesn't work?

Quoted 15 lines

Then, from user app after opening the device, Poll() for rcv data presence was successful and read() call returned non-zero size . Could print the data from ring buffer.

Sincere thanks to you and Michael for guiding me through.

Take care.

regards
Mala