linux/drivers/iio/magnetometer/rm3100-core.c

// SPDX-License-Identifier: GPL-2.0
/*
 * PNI RM3100 3-axis geomagnetic sensor driver core.
 *
 * Copyright (C) 2018 Song Qiang <[email protected]>
 *
 * User Manual available at
 * <https://www.pnicorp.com/download/rm3100-user-manual/>
 *
 * TODO: event generation, pm.
 */

#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/slab.h>

#include <linux/iio/buffer.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/trigger.h>
#include <linux/iio/triggered_buffer.h>
#include <linux/iio/trigger_consumer.h>

#include <asm/unaligned.h>

#include "rm3100.h"

/* Cycle Count Registers. */
#define RM3100_REG_CC_X
#define RM3100_REG_CC_Y
#define RM3100_REG_CC_Z

/* Poll Measurement Mode register. */
#define RM3100_REG_POLL
#define RM3100_POLL_X
#define RM3100_POLL_Y
#define RM3100_POLL_Z

/* Continuous Measurement Mode register. */
#define RM3100_REG_CMM
#define RM3100_CMM_START
#define RM3100_CMM_X
#define RM3100_CMM_Y
#define RM3100_CMM_Z

/* TiMe Rate Configuration register. */
#define RM3100_REG_TMRC
#define RM3100_TMRC_OFFSET

/* Result Status register. */
#define RM3100_REG_STATUS
#define RM3100_STATUS_DRDY

/* Measurement result registers. */
#define RM3100_REG_MX2
#define RM3100_REG_MY2
#define RM3100_REG_MZ2

#define RM3100_W_REG_START
#define RM3100_W_REG_END
#define RM3100_R_REG_START
#define RM3100_R_REG_END
#define RM3100_V_REG_START
#define RM3100_V_REG_END

/*
 * This is computed by hand, is the sum of channel storage bits and padding
 * bits, which is 4+4+4+12=24 in here.
 */
#define RM3100_SCAN_BYTES

#define RM3100_CMM_AXIS_SHIFT

struct rm3100_data {};

static const struct regmap_range rm3100_readable_ranges[] =;

const struct regmap_access_table rm3100_readable_table =;
EXPORT_SYMBOL_NS_GPL();

static const struct regmap_range rm3100_writable_ranges[] =;

const struct regmap_access_table rm3100_writable_table =;
EXPORT_SYMBOL_NS_GPL();

static const struct regmap_range rm3100_volatile_ranges[] =;

const struct regmap_access_table rm3100_volatile_table =;
EXPORT_SYMBOL_NS_GPL();

static irqreturn_t rm3100_thread_fn(int irq, void *d)
{}

static irqreturn_t rm3100_irq_handler(int irq, void *d)
{}

static int rm3100_wait_measurement(struct rm3100_data *data)
{}

static int rm3100_read_mag(struct rm3100_data *data, int idx, int *val)
{}

#define RM3100_CHANNEL(axis, idx)

static const struct iio_chan_spec rm3100_channels[] =;

static IIO_CONST_ATTR_SAMP_FREQ_AVAIL(
	"600 300 150 75 37 18 9 4.5 2.3 1.2 0.6 0.3 0.015 0.075"
);

static struct attribute *rm3100_attributes[] =;

static const struct attribute_group rm3100_attribute_group =;

#define RM3100_SAMP_NUM

/*
 * Frequency : rm3100_samp_rates[][0].rm3100_samp_rates[][1]Hz.
 * Time between reading: rm3100_sam_rates[][2]ms.
 * The first one is actually 1.7ms.
 */
static const int rm3100_samp_rates[RM3100_SAMP_NUM][3] =;

static int rm3100_get_samp_freq(struct rm3100_data *data, int *val, int *val2)
{}

static int rm3100_set_cycle_count(struct rm3100_data *data, int val)
{}

static int rm3100_set_samp_freq(struct iio_dev *indio_dev, int val, int val2)
{}

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

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

static const struct iio_info rm3100_info =;

static int rm3100_buffer_preenable(struct iio_dev *indio_dev)
{}

static int rm3100_buffer_postdisable(struct iio_dev *indio_dev)
{}

static const struct iio_buffer_setup_ops rm3100_buffer_ops =;

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

int rm3100_common_probe(struct device *dev, struct regmap *regmap, int irq)
{}
EXPORT_SYMBOL_NS_GPL();

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