Skip to content
  • Linus Walleij's avatar
    iio: magn: add a driver for AK8974 · 7c94a8b2
    Linus Walleij authored
    This adds a driver for the Asahi Kasei AK8974 and its sibling
    AMI305 magnetometers. It was deployed on scale in 2009 on a
    multitude of devices. It is distincly different from AK8973
    and AK8975 and needs its own driver.
    
    This patch is based on the long lost work of Samu Onkalo at Nokia,
    who made a misc character device driver for the Maemo/MeeGo Nokia
    devices, before the time of the IIO subsystem. It was mounted in e.g.
    the Nokia N950, N8, N86, N97 etc. It is also mounted on the
    ST-Ericsson HREF reference designs.
    
    It works nicely in sysfs:
    
    $ cat in_magn_x_raw && cat in_magn_y_raw && cat in_magn_z_raw
    -55
    -101
    161
    
    And with buffered reads using a simple HRTimer trigger:
    $ generic_buffer -c10 -a -n ak8974 -t foo
    iio device number being used is 3
    iio trigger number being used is 2
    No channels are enabled, enabling all channels
    Enabling: in_magn_x_en
    Enabling: in_magn_y_en
    Enabling: in_magn_z_en
    Enabling: in_timestamp_en
    /sys/bus/iio/devices/iio:device3 foo
    -58.000000 -102....
    7c94a8b2