Commit 23e758b3 authored by Irina Tirdea's avatar Irina Tirdea Committed by Jonathan Cameron

iio: accel: bmc150: use available_scan_masks

Use available_scan_masks to allow the iio core to select
the data to send to userspace depending on which axes are
enabled, instead of doing this in the driver's interrupt
handler.
Signed-off-by: default avatarIrina Tirdea <irina.tirdea@intel.com>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent 91307cbe
...@@ -138,6 +138,7 @@ enum bmc150_accel_axis { ...@@ -138,6 +138,7 @@ enum bmc150_accel_axis {
AXIS_X, AXIS_X,
AXIS_Y, AXIS_Y,
AXIS_Z, AXIS_Z,
AXIS_MAX,
}; };
enum bmc150_power_modes { enum bmc150_power_modes {
...@@ -1104,6 +1105,10 @@ static const struct iio_info bmc150_accel_info_fifo = { ...@@ -1104,6 +1105,10 @@ static const struct iio_info bmc150_accel_info_fifo = {
.driver_module = THIS_MODULE, .driver_module = THIS_MODULE,
}; };
static const unsigned long bmc150_accel_scan_masks[] = {
BIT(AXIS_X) | BIT(AXIS_Y) | BIT(AXIS_Z),
0};
static irqreturn_t bmc150_accel_trigger_handler(int irq, void *p) static irqreturn_t bmc150_accel_trigger_handler(int irq, void *p)
{ {
struct iio_poll_func *pf = p; struct iio_poll_func *pf = p;
...@@ -1113,8 +1118,7 @@ static irqreturn_t bmc150_accel_trigger_handler(int irq, void *p) ...@@ -1113,8 +1118,7 @@ static irqreturn_t bmc150_accel_trigger_handler(int irq, void *p)
unsigned int raw_val; unsigned int raw_val;
mutex_lock(&data->mutex); mutex_lock(&data->mutex);
for_each_set_bit(bit, indio_dev->active_scan_mask, for (bit = 0; bit < AXIS_MAX; bit++) {
indio_dev->masklength) {
ret = regmap_bulk_read(data->regmap, ret = regmap_bulk_read(data->regmap,
BMC150_ACCEL_AXIS_TO_REG(bit), &raw_val, BMC150_ACCEL_AXIS_TO_REG(bit), &raw_val,
2); 2);
...@@ -1574,6 +1578,7 @@ int bmc150_accel_core_probe(struct device *dev, struct regmap *regmap, int irq, ...@@ -1574,6 +1578,7 @@ int bmc150_accel_core_probe(struct device *dev, struct regmap *regmap, int irq,
indio_dev->channels = data->chip_info->channels; indio_dev->channels = data->chip_info->channels;
indio_dev->num_channels = data->chip_info->num_channels; indio_dev->num_channels = data->chip_info->num_channels;
indio_dev->name = name ? name : data->chip_info->name; indio_dev->name = name ? name : data->chip_info->name;
indio_dev->available_scan_masks = bmc150_accel_scan_masks;
indio_dev->modes = INDIO_DIRECT_MODE; indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->info = &bmc150_accel_info; indio_dev->info = &bmc150_accel_info;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment