• Irina Tirdea's avatar
    iio: gyro: bmg160: fix endianness when reading axes · 95e7ff03
    Irina Tirdea authored
    For big endian platforms, reading the axes will return
    invalid values.
    
    The device stores each axis value in a 16 bit little
    endian register. The driver uses regmap_read_bulk to get
    the axis value, resulting in a 16 bit little endian value.
    This needs to be converted to cpu endianness to work
    on big endian platforms.
    
    Fix endianness for big endian platforms by converting
    the values for the axes read from little endian to
    cpu.
    
    This is also partially fixed in commit 82d8e5da1a33 ("iio:
    accel: bmg160: optimize transfers in trigger handler").
    Signed-off-by: default avatarIrina Tirdea <irina.tirdea@intel.com>
    Cc: <Stable@vger.kernel.org>
    Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
    95e7ff03
bmg160_core.c 27.8 KB