Skip to content

Commit

Permalink
inv_mpu: Makefile/Kconfig: Fix up & simplify some configs
Browse files Browse the repository at this point in the history
Seems Samsung might have derp'd a few config-related changes.
This allows for proper usage of the MPU_SENSORS_MPU6050_GYRO config
and makes selftest parts optional.

Fixes:
  drivers/misc/inv_mpu/Kconfig:52:warning: defaults for choice values not supported

Change-Id: I80c476c3e8723403a580c9d25ecfe38bc84ddb3b
Signed-off-by: Luis Cruz <ljc2491@gmail.com>
  • Loading branch information
SyNtheticNightmar3 authored and nardholio committed Jul 29, 2014
1 parent 6ef59c4 commit 95e35a0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
8 changes: 5 additions & 3 deletions drivers/misc/inv_mpu/Kconfig
Expand Up @@ -47,19 +47,21 @@ config MPU_SENSORS_MPU6050B1_411
This driver can also be built as a module. If so, the module
will be called mpu6050b1.

config MPU_SENSORS_MPU6050B1_411
endchoice

config MPU_SENSORS_MPU6050_SELFTEST
bool "Self-test of Invensense MPU-6050 sensor"
depends on MPU_SENSORS_MPU6050_GYRO
default n
help
Say Y here if you want support for self-test of the MPU-6050 sensor
device.
To compile this driver as a module, choose M here: the
module will be called MPU6050.
endchoice

choice
prompt "Gyroscope Type"
depends on I2C && INV_SENSORS
depends on I2C && INV_SENSORS_411
default MPU_SENSORS_MPU3050_GYRO

config MPU_SENSORS_MPU3050_GYRO
Expand Down
16 changes: 5 additions & 11 deletions drivers/misc/inv_mpu/Makefile
Expand Up @@ -4,15 +4,11 @@
#

# MPU
ifdef CONFIG_MPU_SENSORS_MPU3050_411
ifdef CONFIG_MPU_SENSORS_MPU3050_GYRO
INV_MODULE_NAME := mpu3050
endif

ifdef CONFIG_MPU_SENSORS_MPU6050A2_411
INV_MODULE_NAME := mpu6050
endif

ifdef CONFIG_MPU_SENSORS_MPU6050B1_411
ifdef CONFIG_MPU_SENSORS_MPU6050_GYRO
INV_MODULE_NAME := mpu6050
endif

Expand All @@ -24,17 +20,15 @@ $(INV_MODULE_NAME)-objs += mpu-dev.o
$(INV_MODULE_NAME)-objs += mlsl-kernel.o
$(INV_MODULE_NAME)-objs += mldl_cfg.o
$(INV_MODULE_NAME)-objs += mldl_print_cfg.o
ifdef CONFIG_MPU_SENSORS_MPU6050_SELFTEST
$(INV_MODULE_NAME)-objs += mpu6050_selftest.o
endif

ifdef CONFIG_INPUT_YAS_MAGNETOMETER
$(INV_MODULE_NAME)-objs += compass/yas530_ext.o
endif

ifdef CONFIG_MPU_SENSORS_MPU6050A2_411
$(INV_MODULE_NAME)-objs += accel/mpu6050.o
endif

ifdef CONFIG_MPU_SENSORS_MPU6050B1_411
ifdef CONFIG_MPU_SENSORS_MPU6050_GYRO
$(INV_MODULE_NAME)-objs += accel/mpu6050.o
endif

Expand Down
10 changes: 10 additions & 0 deletions drivers/misc/inv_mpu/mpu-dev.c
Expand Up @@ -76,7 +76,10 @@
#define CALIBRATION_FILE_PATH "/efs/calibration_data"
#define CALIBRATION_GYRO_FILE_PATH "/efs/gyro_cal_data"
#define CALIBRATION_DATA_AMOUNT 100

#ifdef CONFIG_MPU_SENSORS_MPU6050_SELFTEST
#include "mpu6050_selftest.h"
#endif

struct acc_data cal_data = {0, 0, 0};

Expand Down Expand Up @@ -1565,6 +1568,7 @@ static ssize_t mpu3050_get_temp(struct device *dev,
return count;
}

#ifdef CONFIG_MPU_SENSORS_MPU6050_SELFTEST
static int gyro_do_calibrate(void)
{
struct file *cal_filp;
Expand Down Expand Up @@ -1656,6 +1660,8 @@ static ssize_t mpu6050_input_gyro_selftest_show(struct device *dev,
(int)abs(ratio[2])%10,
packet_count[0], packet_count[1], packet_count[2]);
}
#endif

static ssize_t mpu3050_acc_read(struct device *dev,
struct device_attribute *attr, char *buf)
{
Expand Down Expand Up @@ -2291,8 +2297,10 @@ static ssize_t akm_name_show(struct device *dev,
static DEVICE_ATTR(power_on, S_IRUGO, mpu3050_power_on, NULL);

static DEVICE_ATTR(temperature, S_IRUGO, mpu3050_get_temp, NULL);
#ifdef CONFIG_MPU_SENSORS_MPU6050_SELFTEST
static struct device_attribute dev_attr_gyro_selftest =
__ATTR(selftest, S_IRUGO, mpu6050_input_gyro_selftest_show, NULL);
#endif
static DEVICE_ATTR(calibration, S_IRUGO|S_IWUSR|S_IWGRP,
accel_calibration_show, accel_calibration_store);

Expand Down Expand Up @@ -2334,7 +2342,9 @@ static struct device_attribute *gyro_sensor_attrs[] = {
&dev_attr_temperature,
&dev_attr_vendor,
&dev_attr_name,
#ifdef CONFIG_MPU_SENSORS_MPU6050_SELFTEST
&dev_attr_gyro_selftest,
#endif
NULL,
};

Expand Down

0 comments on commit 95e35a0

Please sign in to comment.