Linux-Kernel-Sensor-Drivers

Linux sensor drivers for ROHM / Kionix™ sensors

Driver Index

This project is maintained by RohmSemiconductor

Kionix™ is a trademark or a registered trademark of ROHM Co., Ltd.

ROHM BD79105 Analog to Digital Converter (ADC)

The ROHM BD79105 ADC is a single-channel, 16-bit ADC which can be read over SPI.

Linux Driver:

Source Code:

The ROHM Finland SWDC has added support for the BD79105 in the existing Linux driver, in collaboration with the Linux kernel community. Driver is included in the Upstream Linux from v6.18-rc1 onwards.

The Linux kernel can be obtained from:

https://www.kernel.org/

or by cloning Linus Torvald’s official linux development tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux.git

The driver supports reading the ADC channels via the Linux IIO subsystem.

Linux subsystem:

IIO (Industrial input/output)

Quickstart:

Below is an example of simple data capture from an ADC, obtained using the IIO.

Reading one-shot data from the sensor via the IIO sysfs ABI.

1: Find the right IIO device based on the device name.

root@arm:/home/debian# grep -RIl bd79105 /sys/bus/iio/devices/*/name
/sys/bus/iio/devices/iio:device0/name
root@arm:/home/debian#

In the example above:

2: Read the ADC scale which is a multiplier to convert the read raw values to millivolts:

root@arm:~# cat /sys/bus/iio/devices/iio\:device0/in_voltage_scale 
0.805664062
root@arm:~#

3: Read one-shot data for a channel 0 from :

root@arm:~# cat /sys/bus/iio/devices/iio\:device0/in_voltage0_raw 
2230
root@arm:~#

4: scale values to milli Volts:

Apply scale by multiplying the value with scale:

root@arm:~# echo "2230 * 0.805664062" |bc -l
1796.630858260
root@arm:~#

Devicetree example:

    spi {
      #address-cells = <1>;
      #size-cells = <0>;
      adc@0 {
        compatible = rohm,bd79105;
        reg = <0>;
        spi-max-frequency = <66600000>;
        vcc-supply = <&vcc>;
        vref-supply = <&vref>;
        vdrive-supply = <&vdrive>;
      };
    };

Where,