[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VeKDpiLo9eJ+578XSqsoRx3YyKuJ4AJJJ3jTQLaENo=Lw@mail.gmail.com>
Date: Mon, 21 Mar 2022 10:45:23 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Jagath Jog J <jagathjog1996@...il.com>
Cc: Dan Robertson <dan@...obertson.com>,
Jonathan Cameron <jic23@...nel.org>,
linux-iio <linux-iio@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v1 5/5] iio: accel: bma400: Add step change event
On Sat, Mar 19, 2022 at 8:10 PM Jagath Jog J <jagathjog1996@...il.com> wrote:
>
> Added support for event when there is a detection of single step
> or double step change. INT1 pin is used to interrupt and event
> is pushed to userspace.
...
> #include <linux/iio/trigger.h>
> #include <linux/iio/triggered_buffer.h>
> #include <linux/iio/trigger_consumer.h>
> +#include <linux/iio/events.h>
Keep this block ordered,
...
> + switch (chan->type) {
> + case IIO_STEPS:
> + switch (type) {
> + case IIO_EV_TYPE_CHANGE:
> + return data->steps_enabled;
> + default:
> + return -EINVAL;
> + }
> + default:
> + return -EINVAL;
> + }
> + return 0;
Dead code.
...
> + case IIO_STEPS:
> + switch (type) {
> + case IIO_EV_TYPE_CHANGE:
> + mutex_lock(&data->mutex);
> + ret = regmap_update_bits(data->regmap,
> + BMA400_INT12_MAP_REG,
> + BMA400_STEP_INT_MSK,
> + FIELD_PREP(BMA400_STEP_INT_MSK,
> + state));
> + mutex_unlock(&data->mutex);
> + if (ret)
> + return ret;
> + data->steps_enabled = state;
> + return 0;
> + default:
> + return -EINVAL;
> + }
> + default:
> + return -EINVAL;
> + }
> + return 0;
Ditto.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists