linux/drivers/iio/health/max30102.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * max30102.c - Support for MAX30102 heart rate and pulse oximeter sensor
 *
 * Copyright (C) 2017 Matt Ranostay <[email protected]>
 *
 * Support for MAX30105 optical particle sensor
 * Copyright (C) 2017 Peter Meerwald-Stadler <[email protected]>
 *
 * 7-bit I2C chip address: 0x57
 * TODO: proximity power saving feature
 */

#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/mod_devicetable.h>
#include <linux/regmap.h>
#include <linux/iio/iio.h>
#include <linux/iio/buffer.h>
#include <linux/iio/kfifo_buf.h>

#define MAX30102_REGMAP_NAME
#define MAX30102_DRV_NAME
#define MAX30102_PART_NUMBER

enum max30102_chip_id {};

enum max3012_led_idx {};

#define MAX30102_REG_INT_STATUS
#define MAX30102_REG_INT_STATUS_PWR_RDY
#define MAX30102_REG_INT_STATUS_PROX_INT
#define MAX30102_REG_INT_STATUS_ALC_OVF
#define MAX30102_REG_INT_STATUS_PPG_RDY
#define MAX30102_REG_INT_STATUS_FIFO_RDY

#define MAX30102_REG_INT_ENABLE
#define MAX30102_REG_INT_ENABLE_PROX_INT_EN
#define MAX30102_REG_INT_ENABLE_ALC_OVF_EN
#define MAX30102_REG_INT_ENABLE_PPG_EN
#define MAX30102_REG_INT_ENABLE_FIFO_EN
#define MAX30102_REG_INT_ENABLE_MASK
#define MAX30102_REG_INT_ENABLE_MASK_SHIFT

#define MAX30102_REG_FIFO_WR_PTR
#define MAX30102_REG_FIFO_OVR_CTR
#define MAX30102_REG_FIFO_RD_PTR
#define MAX30102_REG_FIFO_DATA
#define MAX30102_REG_FIFO_DATA_BYTES

#define MAX30102_REG_FIFO_CONFIG
#define MAX30102_REG_FIFO_CONFIG_AVG_4SAMPLES
#define MAX30102_REG_FIFO_CONFIG_AVG_SHIFT
#define MAX30102_REG_FIFO_CONFIG_AFULL

#define MAX30102_REG_MODE_CONFIG
#define MAX30102_REG_MODE_CONFIG_MODE_NONE
#define MAX30102_REG_MODE_CONFIG_MODE_HR
#define MAX30102_REG_MODE_CONFIG_MODE_HR_SPO2
#define MAX30102_REG_MODE_CONFIG_MODE_MULTI
#define MAX30102_REG_MODE_CONFIG_MODE_MASK
#define MAX30102_REG_MODE_CONFIG_PWR

#define MAX30102_REG_MODE_CONTROL_SLOT21
#define MAX30102_REG_MODE_CONTROL_SLOT43
#define MAX30102_REG_MODE_CONTROL_SLOT_MASK
#define MAX30102_REG_MODE_CONTROL_SLOT_SHIFT

#define MAX30102_REG_SPO2_CONFIG
#define MAX30102_REG_SPO2_CONFIG_PULSE_411_US
#define MAX30102_REG_SPO2_CONFIG_SR_400HZ
#define MAX30102_REG_SPO2_CONFIG_SR_MASK
#define MAX30102_REG_SPO2_CONFIG_SR_MASK_SHIFT
#define MAX30102_REG_SPO2_CONFIG_ADC_4096_STEPS
#define MAX30102_REG_SPO2_CONFIG_ADC_MASK_SHIFT

#define MAX30102_REG_RED_LED_CONFIG
#define MAX30102_REG_IR_LED_CONFIG
#define MAX30105_REG_GREEN_LED_CONFIG

#define MAX30102_REG_TEMP_CONFIG
#define MAX30102_REG_TEMP_CONFIG_TEMP_EN

#define MAX30102_REG_TEMP_INTEGER
#define MAX30102_REG_TEMP_FRACTION

#define MAX30102_REG_REV_ID
#define MAX30102_REG_PART_ID

struct max30102_data {};

static const struct regmap_config max30102_regmap_config =;

static const unsigned long max30102_scan_masks[] =;

static const unsigned long max30105_scan_masks[] =;

#define MAX30102_INTENSITY_CHANNEL(_si, _mod)

static const struct iio_chan_spec max30102_channels[] =;

static const struct iio_chan_spec max30105_channels[] =;

static int max30102_set_power(struct max30102_data *data, bool en)
{}

static int max30102_set_powermode(struct max30102_data *data, u8 mode, bool en)
{}

#define MAX30102_MODE_CONTROL_LED_SLOTS(slot2, slot1)

static int max30102_buffer_postenable(struct iio_dev *indio_dev)
{}

static int max30102_buffer_predisable(struct iio_dev *indio_dev)
{}

static const struct iio_buffer_setup_ops max30102_buffer_setup_ops =;

static inline int max30102_fifo_count(struct max30102_data *data)
{}

#define MAX30102_COPY_DATA(i)

static int max30102_read_measurement(struct max30102_data *data,
				     unsigned int measurements)
{}

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

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

static int max30102_led_init(struct max30102_data *data)
{}

static int max30102_chip_init(struct max30102_data *data)
{}

static int max30102_read_temp(struct max30102_data *data, int *val)
{}

static int max30102_get_temp(struct max30102_data *data, int *val, bool en)
{}

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

static const struct iio_info max30102_info =;

static int max30102_probe(struct i2c_client *client)
{}

static void max30102_remove(struct i2c_client *client)
{}

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

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

static struct i2c_driver max30102_driver =;
module_i2c_driver();

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