linux/drivers/iio/health/max30100.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * max30100.c - Support for MAX30100 heart rate and pulse oximeter sensor
 *
 * Copyright (C) 2015, 2018
 * Author: Matt Ranostay <[email protected]>
 *
 * TODO: enable pulse length controls via device tree properties
 */

#include <linux/module.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/irq.h>
#include <linux/i2c.h>
#include <linux/mutex.h>
#include <linux/property.h>
#include <linux/regmap.h>
#include <linux/iio/iio.h>
#include <linux/iio/buffer.h>
#include <linux/iio/kfifo_buf.h>

#define MAX30100_REGMAP_NAME
#define MAX30100_DRV_NAME

#define MAX30100_REG_INT_STATUS
#define MAX30100_REG_INT_STATUS_PWR_RDY
#define MAX30100_REG_INT_STATUS_SPO2_RDY
#define MAX30100_REG_INT_STATUS_HR_RDY
#define MAX30100_REG_INT_STATUS_FIFO_RDY

#define MAX30100_REG_INT_ENABLE
#define MAX30100_REG_INT_ENABLE_SPO2_EN
#define MAX30100_REG_INT_ENABLE_HR_EN
#define MAX30100_REG_INT_ENABLE_FIFO_EN
#define MAX30100_REG_INT_ENABLE_MASK
#define MAX30100_REG_INT_ENABLE_MASK_SHIFT

#define MAX30100_REG_FIFO_WR_PTR
#define MAX30100_REG_FIFO_OVR_CTR
#define MAX30100_REG_FIFO_RD_PTR
#define MAX30100_REG_FIFO_DATA
#define MAX30100_REG_FIFO_DATA_ENTRY_COUNT
#define MAX30100_REG_FIFO_DATA_ENTRY_LEN

#define MAX30100_REG_MODE_CONFIG
#define MAX30100_REG_MODE_CONFIG_MODE_SPO2_EN
#define MAX30100_REG_MODE_CONFIG_MODE_HR_EN
#define MAX30100_REG_MODE_CONFIG_MODE_MASK
#define MAX30100_REG_MODE_CONFIG_TEMP_EN
#define MAX30100_REG_MODE_CONFIG_PWR

#define MAX30100_REG_SPO2_CONFIG
#define MAX30100_REG_SPO2_CONFIG_100HZ
#define MAX30100_REG_SPO2_CONFIG_HI_RES_EN
#define MAX30100_REG_SPO2_CONFIG_1600US

#define MAX30100_REG_LED_CONFIG
#define MAX30100_REG_LED_CONFIG_LED_MASK
#define MAX30100_REG_LED_CONFIG_RED_LED_SHIFT

#define MAX30100_REG_LED_CONFIG_24MA
#define MAX30100_REG_LED_CONFIG_50MA

#define MAX30100_REG_TEMP_INTEGER
#define MAX30100_REG_TEMP_FRACTION

struct max30100_data {};

static bool max30100_is_volatile_reg(struct device *dev, unsigned int reg)
{}

static const struct regmap_config max30100_regmap_config =;

static const unsigned int max30100_led_current_mapping[] =;

static const unsigned long max30100_scan_masks[] =;

static const struct iio_chan_spec max30100_channels[] =;

static int max30100_set_powermode(struct max30100_data *data, bool state)
{}

static int max30100_clear_fifo(struct max30100_data *data)
{}

static int max30100_buffer_postenable(struct iio_dev *indio_dev)
{}

static int max30100_buffer_predisable(struct iio_dev *indio_dev)
{}

static const struct iio_buffer_setup_ops max30100_buffer_setup_ops =;

static inline int max30100_fifo_count(struct max30100_data *data)
{}

static int max30100_read_measurement(struct max30100_data *data)
{}

static irqreturn_t max30100_interrupt_handler(int irq, void *private)
{}

static int max30100_get_current_idx(unsigned int val, int *reg)
{}

static int max30100_led_init(struct max30100_data *data)
{}

static int max30100_chip_init(struct max30100_data *data)
{}

static int max30100_read_temp(struct max30100_data *data, int *val)
{}

static int max30100_get_temp(struct max30100_data *data, int *val)
{}

static int max30100_read_raw(struct iio_dev *indio_dev,
			     struct iio_chan_spec const *chan,
			     int *val, int *val2, long mask)
{}

static const struct iio_info max30100_info =;

static int max30100_probe(struct i2c_client *client)
{}

static void max30100_remove(struct i2c_client *client)
{}

static const struct i2c_device_id max30100_id[] =;
MODULE_DEVICE_TABLE(i2c, max30100_id);

static const struct of_device_id max30100_dt_ids[] =;
MODULE_DEVICE_TABLE(of, max30100_dt_ids);

static struct i2c_driver max30100_driver =;
module_i2c_driver();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();