Skip to content

Commit eb72d03

Browse files
Joseph WuJoseph Wu
Joseph Wu
authored and
Joseph Wu
committed
Revert "Sensors: Some minor updates for sensors iio structure."
This reverts commit 3de11fe.
1 parent 857dcab commit eb72d03

File tree

12 files changed

+207
-731
lines changed

12 files changed

+207
-731
lines changed

drivers/staging/iio/imu/inv_mpu/README

+1-58
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ Table of Contents:
2626
> MPU-9150
2727
> MPU-3050 + BMA250 on the secondary I2C interface
2828
- Low Power Accelerometer Mode
29-
- Suspend and Resume
3029
- DMP Event
31-
- Motion Event
3230
- Streaming Data to an Userspace Application
3331
- Recommended Sysfs Entry Setup Sequence
3432
> With DMP Firmware
@@ -411,19 +409,6 @@ Set lpa_freq to 0~3, which correspond to 1.25Hz, 5Hz, 20Hz, 40Hz.
411409
For MPU6500:
412410
Set lpa_freq to 0~11, which correspond to 0.3125Hz to 640Hz.
413411

414-
Suspend and Resume
415-
===================================================
416-
The suspend and resume functions are call backs registered to the system
417-
and executed when the system goes in suspend and resumes.
418-
It is enabled when CONFIG_PM is defined.
419-
The current behavior is simple:
420-
- suspend will turn off the chip
421-
- resume will turn on the chip
422-
423-
However, it is possible for the driver to do more complex things;
424-
for example, leaving pedometers running when system is off. This can save whole
425-
system power while letting pedometer working. Other behaviors are possible
426-
too.
427412

428413
DMP Event
429414
=========
@@ -432,7 +417,7 @@ device (MPU).
432417
Only the MPU-6050, MPU-6500, and MPU-9150 feature the DMP.
433418

434419

435-
There are three sysfs entries for DMP events:
420+
There are four sysfs entries for DMP events:
436421

437422
- event_tap
438423
- event_orientation
@@ -447,48 +432,6 @@ The proper method to poll sysfs is as follows:
447432
4. once the poll passed, use fopen and fread to read the sysfs entry.
448433
5. interpret the data.
449434

450-
Motion Event
451-
============
452-
Motion event are accelerometer enabled event. They don't need dmp nor data output.
453-
Only accelerometer engine needs to be on.
454-
For MPU6050, there are eight sysfs entries for motion events.
455-
----------------------------------
456-
zero_motion_threshold:
457-
threshold for zero motion detection.
458-
459-
zero_motion_dur:
460-
duration for zero motion to trigger.
461-
462-
zero_motion_on:
463-
turn on/off of zero motion function.
464-
465-
motion_threshold:
466-
threshold for motion detection.
467-
468-
motion_dur:
469-
duration for motion to trigger.
470-
471-
motion_on:
472-
turn on/off of motion function.
473-
474-
event_accel_motion:
475-
pollable event sysfs entry for motion.
476-
477-
event_accel_no_motion:
478-
pollable event sysfs entry for zero motion.
479-
-------------------------------------------------------
480-
481-
For MPU6500, there are three sysfs entries for motion events.
482-
------------------------------------------------------------
483-
accel_wom_on:
484-
turn "wake on motion" function on/off.
485-
486-
accel_wom_threshold:
487-
set "wake on motion" threshold.
488-
489-
event_accel_wom:
490-
set event accel_wake on motion.
491-
--------------------------------------------------------
492435

493436
Streaming Data to an Userspace Application
494437
==========================================

drivers/staging/iio/imu/inv_mpu/dmpDefaultMPU6050.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@
167167
#define D_PEDSTD_DECI (768 + 0xA0)
168168

169169
#define D_HOST_NO_MOT (976)
170-
#define D_ACCEL_BIAS (660)
171170

172171
static const struct tKeyLabel dmpTConfig[] = {
173172
{KEY_CFG_27, CFG_27},
@@ -274,8 +273,7 @@ static const struct tKeyLabel dmpTConfig[] = {
274273
{KEY_D_PEDSTD_STEPCTR, D_PEDSTD_STEPCTR},
275274
{KEY_D_PEDSTD_TIMECTR, D_PEDSTD_TIMECTR},
276275
{KEY_D_PEDSTD_DECI, D_PEDSTD_DECI},
277-
{KEY_D_HOST_NO_MOT, D_HOST_NO_MOT},
278-
{KEY_D_ACCEL_BIAS, D_ACCEL_BIAS},
276+
{KEY_D_HOST_NO_MOT, D_HOST_NO_MOT}
279277
};
280278
#define NUM_LOCAL_KEYS (sizeof(dmpTConfig)/sizeof(dmpTConfig[0]))
281279

drivers/staging/iio/imu/inv_mpu/dmpKey.h

+45-2
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,52 @@
253253

254254
/*Host Based No Motion*/
255255
#define KEY_D_HOST_NO_MOT (KEY_D_PEDSTD_DECI + 1)
256-
#define KEY_D_ACCEL_BIAS (KEY_D_HOST_NO_MOT + 1)
257256

258-
#define NUM_KEYS (KEY_D_ACCEL_BIAS + 1)
257+
/* EIS keys */
258+
#define KEY_P_EIS_FIFO_FOOTER (KEY_D_HOST_NO_MOT + 1)
259+
#define KEY_P_EIS_FIFO_YSHIFT (KEY_P_EIS_FIFO_FOOTER + 1)
260+
#define KEY_P_EIS_DATA_RATE (KEY_P_EIS_FIFO_YSHIFT + 1)
261+
#define KEY_P_EIS_FIFO_XSHIFT (KEY_P_EIS_DATA_RATE + 1)
262+
#define KEY_P_EIS_FIFO_SYNC (KEY_P_EIS_FIFO_XSHIFT + 1)
263+
#define KEY_P_EIS_FIFO_ZSHIFT (KEY_P_EIS_FIFO_SYNC + 1)
264+
#define KEY_P_EIS_FIFO_READY (KEY_P_EIS_FIFO_ZSHIFT + 1)
265+
#define KEY_DMP_FOOTER (KEY_P_EIS_FIFO_READY + 1)
266+
#define KEY_DMP_INTX_HC (KEY_DMP_FOOTER + 1)
267+
#define KEY_DMP_INTX_PH (KEY_DMP_INTX_HC + 1)
268+
#define KEY_DMP_INTX_SH (KEY_DMP_INTX_PH + 1)
269+
#define KEY_DMP_AINV_SH (KEY_DMP_INTX_SH + 1)
270+
#define KEY_DMP_A_INV_XH (KEY_DMP_AINV_SH + 1)
271+
#define KEY_DMP_AINV_PH (KEY_DMP_A_INV_XH + 1)
272+
#define KEY_DMP_CTHX_H (KEY_DMP_AINV_PH + 1)
273+
#define KEY_DMP_CTHY_H (KEY_DMP_CTHX_H + 1)
274+
#define KEY_DMP_CTHZ_H (KEY_DMP_CTHY_H + 1)
275+
#define KEY_DMP_NCTHX_H (KEY_DMP_CTHZ_H + 1)
276+
#define KEY_DMP_NCTHY_H (KEY_DMP_NCTHX_H + 1)
277+
#define KEY_DMP_NCTHZ_H (KEY_DMP_NCTHY_H + 1)
278+
#define KEY_DMP_CTSQ_XH (KEY_DMP_NCTHZ_H + 1)
279+
#define KEY_DMP_CTSQ_YH (KEY_DMP_CTSQ_XH + 1)
280+
#define KEY_DMP_CTSQ_ZH (KEY_DMP_CTSQ_YH + 1)
281+
#define KEY_DMP_INTX_H (KEY_DMP_CTSQ_ZH + 1)
282+
#define KEY_DMP_INTY_H (KEY_DMP_INTX_H + 1)
283+
#define KEY_DMP_INTZ_H (KEY_DMP_INTY_H + 1)
284+
#define KEY_DMP_HPX_H (KEY_DMP_INTZ_H + 1)
285+
#define KEY_DMP_HPY_H (KEY_DMP_HPX_H + 1)
286+
#define KEY_DMP_HPZ_H (KEY_DMP_HPY_H + 1)
287+
288+
/* Stream keys */
289+
#define KEY_STREAM_P_GYRO_Z (KEY_DMP_HPZ_H + 1)
290+
#define KEY_STREAM_P_GYRO_Y (KEY_STREAM_P_GYRO_Z + 1)
291+
#define KEY_STREAM_P_GYRO_X (KEY_STREAM_P_GYRO_Y + 1)
292+
#define KEY_STREAM_P_TEMP (KEY_STREAM_P_GYRO_X + 1)
293+
#define KEY_STREAM_P_AUX_Y (KEY_STREAM_P_TEMP + 1)
294+
#define KEY_STREAM_P_AUX_X (KEY_STREAM_P_AUX_Y + 1)
295+
#define KEY_STREAM_P_AUX_Z (KEY_STREAM_P_AUX_X + 1)
296+
#define KEY_STREAM_P_ACCEL_Y (KEY_STREAM_P_AUX_Z + 1)
297+
#define KEY_STREAM_P_ACCEL_X (KEY_STREAM_P_ACCEL_Y + 1)
298+
#define KEY_STREAM_P_FOOTER (KEY_STREAM_P_ACCEL_X + 1)
299+
#define KEY_STREAM_P_ACCEL_Z (KEY_STREAM_P_FOOTER + 1)
300+
301+
#define NUM_KEYS (KEY_STREAM_P_ACCEL_Z + 1)
259302

260303
struct tKeyLabel {
261304
unsigned short key;

drivers/staging/iio/imu/inv_mpu/inv_mpu3050_iio.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ int set_3050_bypass(struct inv_mpu_iio_s *st, bool enable)
5252
{
5353
struct inv_reg_map_s *reg;
5454
int result;
55-
u8 b;
55+
unsigned char b;
5656

5757
reg = &st->reg;
5858
result = inv_i2c_read(st, reg->user_ctrl, 1, &b);
@@ -127,7 +127,7 @@ void inv_setup_reg_mpu3050(struct inv_reg_map_s *reg)
127127
int inv_switch_3050_gyro_engine(struct inv_mpu_iio_s *st, bool en)
128128
{
129129
struct inv_reg_map_s *reg;
130-
u8 data, p;
130+
unsigned char data, p;
131131
int result;
132132
reg = &st->reg;
133133
if (en) {
@@ -177,7 +177,7 @@ int inv_init_config_mpu3050(struct iio_dev *indio_dev)
177177
{
178178
struct inv_reg_map_s *reg;
179179
int result;
180-
u8 data;
180+
unsigned char data;
181181
struct inv_mpu_iio_s *st = iio_priv(indio_dev);
182182

183183
if (st->chip_config.is_asleep)
@@ -240,7 +240,7 @@ int inv_init_config_mpu3050(struct iio_dev *indio_dev)
240240
int set_power_mpu3050(struct inv_mpu_iio_s *st, bool power_on)
241241
{
242242
struct inv_reg_map_s *reg;
243-
u8 data, p;
243+
unsigned char data, p;
244244
int result;
245245
reg = &st->reg;
246246
if (power_on) {

0 commit comments

Comments
 (0)