summaryrefslogtreecommitdiff
path: root/drivers/iio/imu/inv_mpu6050/inv_mpu_magn.h
blob: f7ad50ca6c1b111a07fb2157b082f7af9aa49ade (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright (C) 2019 TDK-InvenSense, Inc.
 */

#ifndef INV_MPU_MAGN_H_
#define INV_MPU_MAGN_H_

#include <linux/kernel.h>

#include "inv_mpu_iio.h"

int inv_mpu_magn_probe(struct inv_mpu6050_state *st);

/**
 * inv_mpu_magn_get_scale() - get magnetometer scale value
 * @st: driver internal state
 *
 * Returns IIO data format.
 */
static inline int inv_mpu_magn_get_scale(const struct inv_mpu6050_state *st,
					 const struct iio_chan_spec *chan,
					 int *val, int *val2)
{
	*val = 0;
	*val2 = st->magn_raw_to_gauss[chan->address];
	return IIO_VAL_INT_PLUS_MICRO;
}

int inv_mpu_magn_set_rate(const struct inv_mpu6050_state *st, int fifo_rate);

int inv_mpu_magn_set_orient(struct inv_mpu6050_state *st);

int inv_mpu_magn_read(struct inv_mpu6050_state *st, int axis, int *val);

#endif		/* INV_MPU_MAGN_H_ */