Source
x
/*
* MMC35240 - MEMSIC 3-axis Magnetic Sensor
*
* Copyright (c) 2015, Intel Corporation.
*
* This file is subject to the terms and conditions of version 2 of
* the GNU General Public License. See the file COPYING in the main
* directory of this archive for more details.
*
* IIO driver for MMC35240 (7-bit I2C slave address 0x30).
*
* TODO: offset, ACPI, continuous measurement mode, PM
*/
/* output resolution bits */
/* us */
/* us */
/*
* Memsic OTP process code piece is put here for reference:
*
* #define OTP_CONVERT(REG) ((float)((REG) >=32 ? (32 - (REG)) : (REG)) * 0.006
* 1) For X axis, the COEFFICIENT is always 1.
* 2) For Y axis, the COEFFICIENT is as below:
* f_OTP_matrix[4] = OTP_CONVERT(((reg_data[1] & 0x03) << 4) |
* (reg_data[2] >> 4)) + 1.0;
* 3) For Z axis, the COEFFICIENT is as below:
* f_OTP_matrix[8] = (OTP_CONVERT(reg_data[3] & 0x3f) + 1) * 1.35;
* We implemented the OTP logic into driver.
*/
/* scale = 1000 here for Y otp */
/* 0.6 * 1.35 = 0.81, scale 10000 for Z otp */
enum mmc35240_resolution {
MMC35240_16_BITS_SLOW = 0, /* 7.92 ms */
MMC35240_16_BITS_FAST, /* 4.08 ms */
MMC35240_14_BITS, /* 2.16 ms */
MMC35240_12_BITS, /* 1.20 ms */
};