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 BU79100G Analog to Digital Converter (ADC)

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

Resources

Linux Driver:

Source Code:

The ROHM BU79100G can be operated using the upstream ad7476 driver. Support for BU79100G like devices should be found from the Linux v5.1-rc1 onwards, but the compatible string for the BU79100G is not supported there.

See this patch for the BU79100G support.

NOTE: Ideally the device-tree should use ti,ads7866 as a fallback compatible for the BU79100G, because some of the device drivers may use ti,ads7866 code-branch to avoid code duplication. Due to historical reasons the above ID patch is still needed on Linux. Please, see the device-tree example below for the details.

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 bd79100 /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 {
        adc: adc@0 {
            compatible = "rohm,bd79100g", "ti,ads7866";
            reg = <0>;
            vcc-supply = <&dummyreg>; 
            spi-max-frequency = <20000000>;
        };
    };

Please note the compatible:

compatible = "rohm,bd79100g", "ti,ads7866";

Using the ti,ads7866 as a fallback ensures that the sensor is working even when driver is optimized to avoid code duplication. (Device-tree validation is failing until this patch gets merged).