linux/drivers/iio/magnetometer/bmc150_magn.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Bosch BMC150 three-axis magnetic field sensor driver
 *
 * Copyright (c) 2015, Intel Corporation.
 *
 * This code is based on bmm050_api.c authored by [email protected]:
 *
 * (C) Copyright 2011~2014 Bosch Sensortec GmbH All Rights Reserved
 */

#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/acpi.h>
#include <linux/pm.h>
#include <linux/pm_runtime.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/buffer.h>
#include <linux/iio/events.h>
#include <linux/iio/trigger.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>

#include "bmc150_magn.h"

#define BMC150_MAGN_DRV_NAME
#define BMC150_MAGN_IRQ_NAME

#define BMC150_MAGN_REG_CHIP_ID
#define BMC150_MAGN_CHIP_ID_VAL

#define BMC150_MAGN_REG_X_L
#define BMC150_MAGN_REG_X_M
#define BMC150_MAGN_REG_Y_L
#define BMC150_MAGN_REG_Y_M
#define BMC150_MAGN_SHIFT_XY_L
#define BMC150_MAGN_REG_Z_L
#define BMC150_MAGN_REG_Z_M
#define BMC150_MAGN_SHIFT_Z_L
#define BMC150_MAGN_REG_RHALL_L
#define BMC150_MAGN_REG_RHALL_M
#define BMC150_MAGN_SHIFT_RHALL_L

#define BMC150_MAGN_REG_INT_STATUS

#define BMC150_MAGN_REG_POWER
#define BMC150_MAGN_MASK_POWER_CTL

#define BMC150_MAGN_REG_OPMODE_ODR
#define BMC150_MAGN_MASK_OPMODE
#define BMC150_MAGN_SHIFT_OPMODE
#define BMC150_MAGN_MODE_NORMAL
#define BMC150_MAGN_MODE_FORCED
#define BMC150_MAGN_MODE_SLEEP
#define BMC150_MAGN_MASK_ODR
#define BMC150_MAGN_SHIFT_ODR

#define BMC150_MAGN_REG_INT

#define BMC150_MAGN_REG_INT_DRDY
#define BMC150_MAGN_MASK_DRDY_EN
#define BMC150_MAGN_SHIFT_DRDY_EN
#define BMC150_MAGN_MASK_DRDY_INT3
#define BMC150_MAGN_MASK_DRDY_Z_EN
#define BMC150_MAGN_MASK_DRDY_Y_EN
#define BMC150_MAGN_MASK_DRDY_X_EN
#define BMC150_MAGN_MASK_DRDY_DR_POLARITY
#define BMC150_MAGN_MASK_DRDY_LATCHING
#define BMC150_MAGN_MASK_DRDY_INT3_POLARITY

#define BMC150_MAGN_REG_LOW_THRESH
#define BMC150_MAGN_REG_HIGH_THRESH
#define BMC150_MAGN_REG_REP_XY
#define BMC150_MAGN_REG_REP_Z
#define BMC150_MAGN_REG_REP_DATAMASK

#define BMC150_MAGN_REG_TRIM_START
#define BMC150_MAGN_REG_TRIM_END

#define BMC150_MAGN_XY_OVERFLOW_VAL
#define BMC150_MAGN_Z_OVERFLOW_VAL

/* Time from SUSPEND to SLEEP */
#define BMC150_MAGN_START_UP_TIME_MS

#define BMC150_MAGN_AUTO_SUSPEND_DELAY_MS

#define BMC150_MAGN_REGVAL_TO_REPXY(regval)
#define BMC150_MAGN_REGVAL_TO_REPZ(regval)
#define BMC150_MAGN_REPXY_TO_REGVAL(rep)
#define BMC150_MAGN_REPZ_TO_REGVAL(rep)

enum bmc150_magn_axis {};

enum bmc150_magn_power_modes {};

struct bmc150_magn_trim_regs {} __packed;

struct bmc150_magn_data {};

static const struct {} bmc150_magn_samp_freq_table[] =;

enum bmc150_magn_presets {};

static const struct bmc150_magn_preset {} bmc150_magn_presets_table[] =;

#define BMC150_MAGN_DEFAULT_PRESET

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

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

const struct regmap_config bmc150_magn_regmap_config =;
EXPORT_SYMBOL_NS();

static int bmc150_magn_set_power_mode(struct bmc150_magn_data *data,
				      enum bmc150_magn_power_modes mode,
				      bool state)
{}

static int bmc150_magn_set_power_state(struct bmc150_magn_data *data, bool on)
{}

static int bmc150_magn_get_odr(struct bmc150_magn_data *data, int *val)
{}

static int bmc150_magn_set_odr(struct bmc150_magn_data *data, int val)
{}

static int bmc150_magn_set_max_odr(struct bmc150_magn_data *data, int rep_xy,
				   int rep_z, int odr)
{}

static s32 bmc150_magn_compensate_x(struct bmc150_magn_trim_regs *tregs, s16 x,
				    u16 rhall)
{}

static s32 bmc150_magn_compensate_y(struct bmc150_magn_trim_regs *tregs, s16 y,
				    u16 rhall)
{}

static s32 bmc150_magn_compensate_z(struct bmc150_magn_trim_regs *tregs, s16 z,
				    u16 rhall)
{}

static int bmc150_magn_read_xyz(struct bmc150_magn_data *data, s32 *buffer)
{}

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

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

static ssize_t bmc150_magn_show_samp_freq_avail(struct device *dev,
						struct device_attribute *attr,
						char *buf)
{}

static const struct iio_mount_matrix *
bmc150_magn_get_mount_matrix(const struct iio_dev *indio_dev,
			      const struct iio_chan_spec *chan)
{}

static const struct iio_chan_spec_ext_info bmc150_magn_ext_info[] =;

static IIO_DEV_ATTR_SAMP_FREQ_AVAIL(bmc150_magn_show_samp_freq_avail);

static struct attribute *bmc150_magn_attributes[] =;

static const struct attribute_group bmc150_magn_attrs_group =;

#define BMC150_MAGN_CHANNEL(_axis)

static const struct iio_chan_spec bmc150_magn_channels[] =;

static const struct iio_info bmc150_magn_info =;

static const unsigned long bmc150_magn_scan_masks[] =;

static irqreturn_t bmc150_magn_trigger_handler(int irq, void *p)
{}

static int bmc150_magn_init(struct bmc150_magn_data *data)
{}

static int bmc150_magn_reset_intr(struct bmc150_magn_data *data)
{}

static void bmc150_magn_trig_reen(struct iio_trigger *trig)
{}

static int bmc150_magn_data_rdy_trigger_set_state(struct iio_trigger *trig,
						  bool state)
{}

static const struct iio_trigger_ops bmc150_magn_trigger_ops =;

static int bmc150_magn_buffer_preenable(struct iio_dev *indio_dev)
{}

static int bmc150_magn_buffer_postdisable(struct iio_dev *indio_dev)
{}

static const struct iio_buffer_setup_ops bmc150_magn_buffer_setup_ops =;

static const char *bmc150_magn_match_acpi_device(struct device *dev)
{}

int bmc150_magn_probe(struct device *dev, struct regmap *regmap,
		      int irq, const char *name)
{}
EXPORT_SYMBOL_NS();

void bmc150_magn_remove(struct device *dev)
{}
EXPORT_SYMBOL_NS();

#ifdef CONFIG_PM
static int bmc150_magn_runtime_suspend(struct device *dev)
{}

/*
 * Should be called with data->mutex held.
 */
static int bmc150_magn_runtime_resume(struct device *dev)
{}
#endif

#ifdef CONFIG_PM_SLEEP
static int bmc150_magn_suspend(struct device *dev)
{}

static int bmc150_magn_resume(struct device *dev)
{}
#endif

const struct dev_pm_ops bmc150_magn_pm_ops =;
EXPORT_SYMBOL_NS();

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