linux/drivers/iio/chemical/bme680_core.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Bosch BME680 - Temperature, Pressure, Humidity & Gas Sensor
 *
 * Copyright (C) 2017 - 2018 Bosch Sensortec GmbH
 * Copyright (C) 2018 Himanshu Jha <[email protected]>
 *
 * Datasheet:
 * https://ae-bst.resource.bosch.com/media/_tech/media/datasheets/BST-BME680-DS001-00.pdf
 */
#include <linux/bitfield.h>
#include <linux/cleanup.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/log2.h>
#include <linux/module.h>
#include <linux/regmap.h>

#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>

#include <linux/unaligned.h>

#include "bme680.h"

/* 1st set of calibration data */
enum {};

/* 2nd set of calibration data */
enum {};

/* 3rd set of calibration data */
enum {};

struct bme680_calib {};

struct bme680_data {};

static const struct regmap_range bme680_volatile_ranges[] =;

static const struct regmap_access_table bme680_volatile_table =;

const struct regmap_config bme680_regmap_config =;
EXPORT_SYMBOL_NS();

static const struct iio_chan_spec bme680_channels[] =;

static int bme680_read_calib(struct bme680_data *data,
			     struct bme680_calib *calib)
{}

static int bme680_read_temp_adc(struct bme680_data *data, u32 *adc_temp)
{}

/*
 * Taken from Bosch BME680 API:
 * https://github.com/BoschSensortec/BME680_driver/blob/63bb5336/bme680.c#L876
 *
 * Returns temperature measurement in DegC, resolutions is 0.01 DegC. Therefore,
 * output value of "3233" represents 32.33 DegC.
 */
static s32 bme680_calc_t_fine(struct bme680_data *data, u32 adc_temp)
{}

static int bme680_get_t_fine(struct bme680_data *data, s32 *t_fine)
{}

static s16 bme680_compensate_temp(struct bme680_data *data,
				  u32 adc_temp)
{}

static int bme680_read_press_adc(struct bme680_data *data, u32 *adc_press)
{}

/*
 * Taken from Bosch BME680 API:
 * https://github.com/BoschSensortec/BME680_driver/blob/63bb5336/bme680.c#L896
 *
 * Returns pressure measurement in Pa. Output value of "97356" represents
 * 97356 Pa = 973.56 hPa.
 */
static u32 bme680_compensate_press(struct bme680_data *data,
				   u32 adc_press, s32 t_fine)
{}

static int bme680_read_humid_adc(struct bme680_data *data, u32 *adc_humidity)
{}

/*
 * Taken from Bosch BME680 API:
 * https://github.com/BoschSensortec/BME680_driver/blob/63bb5336/bme680.c#L937
 *
 * Returns humidity measurement in percent, resolution is 0.001 percent. Output
 * value of "43215" represents 43.215 %rH.
 */
static u32 bme680_compensate_humid(struct bme680_data *data,
				   u16 adc_humid, s32 t_fine)
{}

/*
 * Taken from Bosch BME680 API:
 * https://github.com/BoschSensortec/BME680_driver/blob/63bb5336/bme680.c#L973
 *
 * Returns gas measurement in Ohm. Output value of "82986" represent 82986 ohms.
 */
static u32 bme680_compensate_gas(struct bme680_data *data, u16 gas_res_adc,
				 u8 gas_range)
{}

/*
 * Taken from Bosch BME680 API:
 * https://github.com/BoschSensortec/BME680_driver/blob/63bb5336/bme680.c#L1002
 */
static u8 bme680_calc_heater_res(struct bme680_data *data, u16 temp)
{}

/*
 * Taken from Bosch BME680 API:
 * https://github.com/BoschSensortec/BME680_driver/blob/63bb5336/bme680.c#L1188
 */
static u8 bme680_calc_heater_dur(u16 dur)
{}

static int bme680_set_mode(struct bme680_data *data, bool mode)
{}

static u8 bme680_oversampling_to_reg(u8 val)
{}

/*
 * Taken from Bosch BME680 API:
 * https://github.com/boschsensortec/BME68x_SensorAPI/blob/v4.4.8/bme68x.c#L490
 */
static int bme680_wait_for_eoc(struct bme680_data *data)
{}

static int bme680_chip_config(struct bme680_data *data)
{}

static int bme680_gas_config(struct bme680_data *data)
{}

static int bme680_read_temp(struct bme680_data *data, int *val)
{}

static int bme680_read_press(struct bme680_data *data,
			     int *val, int *val2)
{}

static int bme680_read_humid(struct bme680_data *data,
			     int *val, int *val2)
{}

static int bme680_read_gas(struct bme680_data *data,
			   int *val)
{}

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

static bool bme680_is_valid_oversampling(int rate)
{}

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

static const char bme680_oversampling_ratio_show[] =;

static IIO_CONST_ATTR(oversampling_ratio_available,
		      bme680_oversampling_ratio_show);

static struct attribute *bme680_attributes[] =;

static const struct attribute_group bme680_attribute_group =;

static const struct iio_info bme680_info =;

int bme680_core_probe(struct device *dev, struct regmap *regmap,
		      const char *name)
{}
EXPORT_SYMBOL_NS_GPL();

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