max30100.c (828f84ee8f84710ea1818b3565add268bcb824c8) max30100.c (18e2452a3c4e830bff9628ec0e25a814df491e30)
1/*
2 * max30100.c - Support for MAX30100 heart rate and pulse oximeter sensor
3 *
4 * Copyright (C) 2015 Matt Ranostay <mranostay@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 224 unchanged lines hidden (view full) ---

233static irqreturn_t max30100_interrupt_handler(int irq, void *private)
234{
235 struct iio_dev *indio_dev = private;
236 struct max30100_data *data = iio_priv(indio_dev);
237 int ret, cnt = 0;
238
239 mutex_lock(&data->lock);
240
1/*
2 * max30100.c - Support for MAX30100 heart rate and pulse oximeter sensor
3 *
4 * Copyright (C) 2015 Matt Ranostay <mranostay@gmail.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 224 unchanged lines hidden (view full) ---

233static irqreturn_t max30100_interrupt_handler(int irq, void *private)
234{
235 struct iio_dev *indio_dev = private;
236 struct max30100_data *data = iio_priv(indio_dev);
237 int ret, cnt = 0;
238
239 mutex_lock(&data->lock);
240
241 while (cnt || (cnt = max30100_fifo_count(data)) > 0) {
241 while (cnt || (cnt = max30100_fifo_count(data) > 0)) {
242 ret = max30100_read_measurement(data);
243 if (ret)
244 break;
245
246 iio_push_to_buffers(data->indio_dev, data->buffer);
247 cnt--;
248 }
249

--- 123 unchanged lines hidden (view full) ---

373
374 /* start acquisition */
375 ret = regmap_update_bits(data->regmap, MAX30100_REG_MODE_CONFIG,
376 MAX30100_REG_MODE_CONFIG_TEMP_EN,
377 MAX30100_REG_MODE_CONFIG_TEMP_EN);
378 if (ret)
379 return ret;
380
242 ret = max30100_read_measurement(data);
243 if (ret)
244 break;
245
246 iio_push_to_buffers(data->indio_dev, data->buffer);
247 cnt--;
248 }
249

--- 123 unchanged lines hidden (view full) ---

373
374 /* start acquisition */
375 ret = regmap_update_bits(data->regmap, MAX30100_REG_MODE_CONFIG,
376 MAX30100_REG_MODE_CONFIG_TEMP_EN,
377 MAX30100_REG_MODE_CONFIG_TEMP_EN);
378 if (ret)
379 return ret;
380
381 usleep_range(35000, 50000);
381 msleep(35);
382
383 return max30100_read_temp(data, val);
384}
385
386static int max30100_read_raw(struct iio_dev *indio_dev,
387 struct iio_chan_spec const *chan,
388 int *val, int *val2, long mask)
389{

--- 134 unchanged lines hidden ---
382
383 return max30100_read_temp(data, val);
384}
385
386static int max30100_read_raw(struct iio_dev *indio_dev,
387 struct iio_chan_spec const *chan,
388 int *val, int *val2, long mask)
389{

--- 134 unchanged lines hidden ---