• Linus Walleij's avatar
    iio: magnetometer: ak8974: Provide scaling · 16636527
    Linus Walleij authored
    The manual for the HSCDTD008A gives us a scaling for the
    three axis as +/- 2.4mT (24 Gauss) per axis.
    
    The manual for the AMI305 and AMI306 gives us a scaling
    for the three axis as +/- 12 Gauss per axis.
    
    Tests with the HSCDTD008A sensor, cat the raw values:
    $ cat in_magn_*_raw
    raw
    45
    189
    -19
    
    The scaling factor in in_magn_*_scale is 0.001464843,
    which gives:
    0.065 Gauss
    0.277 Gauss
    -0.027 Gauss
    
    The earths magnetic field is in the range of 0.25 to 0.65
    Gauss on the surface according to Wikipedia, so these
    seem like reasonable values.
    
    Again we are guessing that the AK8974 has a 12 bit ADC,
    based on the similarity with AMI305 and AMI306.
    
    Cc: Nick Reitemeyer <nick.reitemeyer@web.de>
    Cc: Stephan Gerhold <stephan@gerhold.net>
    Cc: Michał Mirosław <mirq-linux@rere.qmqm.pl>
    Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
    Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
    16636527
ak8974.c 26.8 KB