• Irina Tirdea's avatar
    iio: accel: bmc150: fix endianness when reading axes · 2215f31d
    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 b6fb9b6d6552 ("iio:
    accel: bmc150: 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>
    2215f31d
bmc150-accel-core.c 43.6 KB