![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0 */ 0002 #include <linux/iio/iio.h> 0003 #include <linux/mutex.h> 0004 #include <linux/regmap.h> 0005 #include <linux/regulator/consumer.h> 0006 #include <linux/i2c.h> 0007 0008 /** 0009 * enum mpu3050_fullscale - indicates the full range of the sensor in deg/sec 0010 */ 0011 enum mpu3050_fullscale { 0012 FS_250_DPS = 0, 0013 FS_500_DPS, 0014 FS_1000_DPS, 0015 FS_2000_DPS, 0016 }; 0017 0018 /** 0019 * enum mpu3050_lpf - indicates the low pass filter width 0020 */ 0021 enum mpu3050_lpf { 0022 /* This implicity sets sample frequency to 8 kHz */ 0023 LPF_256_HZ_NOLPF = 0, 0024 /* All others sets the sample frequency to 1 kHz */ 0025 LPF_188_HZ, 0026 LPF_98_HZ, 0027 LPF_42_HZ, 0028 LPF_20_HZ, 0029 LPF_10_HZ, 0030 LPF_5_HZ, 0031 LPF_2100_HZ_NOLPF, 0032 }; 0033 0034 enum mpu3050_axis { 0035 AXIS_X = 0, 0036 AXIS_Y, 0037 AXIS_Z, 0038 AXIS_MAX, 0039 }; 0040 0041 /** 0042 * struct mpu3050 - instance state container for the device 0043 * @dev: parent device for this instance 0044 * @orientation: mounting matrix, flipped axis etc 0045 * @map: regmap to reach the registers 0046 * @lock: serialization lock to marshal all requests 0047 * @irq: the IRQ used for this device 0048 * @regs: the regulators to power this device 0049 * @fullscale: the current fullscale setting for the device 0050 * @lpf: digital low pass filter setting for the device 0051 * @divisor: base frequency divider: divides 8 or 1 kHz 0052 * @calibration: the three signed 16-bit calibration settings that 0053 * get written into the offset registers for each axis to compensate 0054 * for DC offsets 0055 * @trig: trigger for the MPU-3050 interrupt, if present 0056 * @hw_irq_trigger: hardware interrupt trigger is in use 0057 * @irq_actl: interrupt is active low 0058 * @irq_latch: latched IRQ, this means that it is a level IRQ 0059 * @irq_opendrain: the interrupt line shall be configured open drain 0060 * @pending_fifo_footer: tells us if there is a pending footer in the FIFO 0061 * that we have to read out first when handling the FIFO 0062 * @hw_timestamp: latest hardware timestamp from the trigger IRQ, when in 0063 * use 0064 * @i2cmux: an I2C mux reflecting the fact that this sensor is a hub with 0065 * a pass-through I2C interface coming out of it: this device needs to be 0066 * powered up in order to reach devices on the other side of this mux 0067 */ 0068 struct mpu3050 { 0069 struct device *dev; 0070 struct iio_mount_matrix orientation; 0071 struct regmap *map; 0072 struct mutex lock; 0073 int irq; 0074 struct regulator_bulk_data regs[2]; 0075 enum mpu3050_fullscale fullscale; 0076 enum mpu3050_lpf lpf; 0077 u8 divisor; 0078 s16 calibration[3]; 0079 struct iio_trigger *trig; 0080 bool hw_irq_trigger; 0081 bool irq_actl; 0082 bool irq_latch; 0083 bool irq_opendrain; 0084 bool pending_fifo_footer; 0085 s64 hw_timestamp; 0086 struct i2c_mux_core *i2cmux; 0087 }; 0088 0089 /* Probe called from different transports */ 0090 int mpu3050_common_probe(struct device *dev, 0091 struct regmap *map, 0092 int irq, 0093 const char *name); 0094 void mpu3050_common_remove(struct device *dev); 0095 0096 /* PM ops */ 0097 extern const struct dev_pm_ops mpu3050_dev_pm_ops;
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |