Using IIO driver as a Loadable kernel module

92 views
Skip to first unread message

Bashid

unread,
Jan 2, 2019, 5:25:15 AM1/2/19
to BeagleBoard
Hello

I want use ti-ads8688 iio driver as a kernel module. I am using Beaglebone Black.

I wrote below Makefile for this work.

obj-m+=ti-ads8688.o
all:
    make -C /lib/modules/$(shell uname -r)/build/ M=$(PWD) modules
clean:
    make -C /lib/modules/$(shell uname -r)/build/ M=$(PWD) clean

ti-ads8688.ko file correctly generated and i load it with insmod command. But there is not module in iio devices, as you can see in below:

debian@beaglebone:~/work/phase1$ ls /sys/bus/iio/devices/iio\:device0
buffer           in_voltage1_raw  in_voltage4_raw  in_voltage7_raw  power          uevent
dev              in_voltage2_raw  in_voltage5_raw  name             scan_elements
in_voltage0_raw  in_voltage3_raw  in_voltage6_raw  of_node          subsystem

am i miss something? I also add in my devicetree below unit:

adc@0 {
    compatible = "ti,ads8688";
    reg = <0>;
    spi-cpha;
    spi-max-frequency = <100000>;
};

I think the problem is with my device tree, but I don't know how fix it.

Bashid

unread,
Jan 2, 2019, 6:23:31 AM1/2/19
to BeagleBoard
this is the device tree recommendation of texas instrument.
when i add below devicetree to a dtb_overlay tree:
adc@0 {
    compatible = "ti,ads8688";
    reg = <0>;
    spi-cpha;
    spi-max-frequency = <100000>;
};
the board crash. when i change it to below:
adc@2 {
    compatible = "ti,ads8688";
    reg = <0>;
    spi-cpha;
    spi-max-frequency = <100000>;
};

the board don't crash but the iio problem in first post still there.

Bashid

unread,
Jan 10, 2019, 1:19:48 AM1/10/19
to BeagleBoard
Solution was easy!
First disable default ADC overlay in uEnv.txt (optional)
then change my device tree to a better one!
related section of my device tree is below:

fragment@2 {
 target
= <&spi0>;
 __overlay__
{
 status
= "okay";

 adc@0
{
 compatible
= "ti,ads8688";
 reg
= <0>;

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

Because the ads8688 use spi for communication. I must introduce it to spi interface!
Reply all
Reply to author
Forward
0 new messages