I can read/write gpio pins from the kernel module, but now I should read/access ADC channels from the kernel modules.
I found some examples, but each uses file access with the open / read / close commands. they work well in user space but not in kernel space.
Some sample code uses sysfs_open with changing code segment (KERNEL_DS) (Unfortunately) I could not compile my module because the sysfs commands were not exported in Linux source and I think the file operations is not a good idea in kernel space.
I’m working on a custom build Linux with 5.4 kernel on Beaglebone Black. Thanks to some articles by Derek Molloy, I can access to gpio, but I got stuck at the ADC (iio).
(I see and I can read the /sys/bus/iio/devices/iio:device0/in_voltageX_raw and in user space works fine.)
What is the correct mode or how can I read ADC channels from the kernel space/module (without segment manipulation)?
(I’m also interested in using the UART in kernel module…)
Please, anyone help me with any useful information.
Thank you in advance.