• Lars-Peter Clausen's avatar
    staging:iio:ad7476: Fix off by one error for channel shift · cb75f233
    Lars-Peter Clausen authored
    The datasheet is a bit confusing about this. It says that a dataword has 4
    leading zeros, but the first zero is already put on the bus when CS is pulled
    low and the second zero is put on the bus on the first leading edge of SCLK, so
    when the first bit is sampled on the first trailing edge it will sample what the
    datasheet refers to as the second leading zero. Subsequently we only see 3
    leading zeros in the 16 bit dataword and the result we get is shifted to the
    left by one bit. Fix this by adjusting the channel shift by 1.
    Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
    Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
    cb75f233
ad7476_core.c 5.62 KB