iio: accel: mma8452: improvements to handle multiple events
authorHarinath Nampally <harinath922@gmail.com>
Sat, 9 Sep 2017 19:56:58 +0000 (15:56 -0400)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Wed, 13 Sep 2017 16:49:58 +0000 (17:49 +0100)
commit605f72de137ad92a9c29ca1d3d1fead34685b1af
tree48bb20ca7e6e54911609f7cfaedb9ad954f347e9
parent49b3f87496a7c646da3f900fd502f68a687457ad
iio: accel: mma8452: improvements to handle multiple events

    This driver supports multiple devices like mma8653,
    mma8652, mma8452, mma8453 and fxls8471. Almost all
    these devices have more than one event.

    Current driver design hardcodes the event specific
    information, so only one event can be supported by this
    driver at any given time.
    Also current design doesn't have the flexibility to
    add more events.

    This patch improves by detaching the event related
    information from chip_info struct,and based on channel
    type and event direction the corresponding event
    configuration registers are picked dynamically.
    Hence both transient and freefall events can be
    handled in read/write callbacks.

    Changes are thoroughly tested on fxls8471 device on imx6UL
    Eval board using iio_event_monitor user space program.

    After this fix both Freefall and Transient events are
    handled by the driver without any conflicts.

Signed-off-by: Harinath Nampally <harinath922@gmail.com>
Reviewed-by: Martin Kepplinger <martink@posteo.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/accel/mma8452.c