iio: imu: mpu6050: add mpu6500 register settings
authorMatt Ranostay <matt.ranostay@intel.com>
Mon, 22 Feb 2016 21:39:11 +0000 (13:39 -0800)
committerJonathan Cameron <jic23@kernel.org>
Thu, 25 Feb 2016 19:54:27 +0000 (19:54 +0000)
Signed-off-by: Matt Ranostay <matt.ranostay@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h
drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c

index 53b302960654d91e9d2d21668fbf14989ec3cc47..d192953e9a385f046fd0e8e51fa5dd9105fcc83b 100644 (file)
@@ -39,6 +39,26 @@ static const int gyro_scale_6050[] = {133090, 266181, 532362, 1064724};
  */
 static const int accel_scale[] = {598, 1196, 2392, 4785};
 
+static const struct inv_mpu6050_reg_map reg_set_6500 = {
+       .sample_rate_div        = INV_MPU6050_REG_SAMPLE_RATE_DIV,
+       .lpf                    = INV_MPU6050_REG_CONFIG,
+       .user_ctrl              = INV_MPU6050_REG_USER_CTRL,
+       .fifo_en                = INV_MPU6050_REG_FIFO_EN,
+       .gyro_config            = INV_MPU6050_REG_GYRO_CONFIG,
+       .accl_config            = INV_MPU6050_REG_ACCEL_CONFIG,
+       .fifo_count_h           = INV_MPU6050_REG_FIFO_COUNT_H,
+       .fifo_r_w               = INV_MPU6050_REG_FIFO_R_W,
+       .raw_gyro               = INV_MPU6050_REG_RAW_GYRO,
+       .raw_accl               = INV_MPU6050_REG_RAW_ACCEL,
+       .temperature            = INV_MPU6050_REG_TEMPERATURE,
+       .int_enable             = INV_MPU6050_REG_INT_ENABLE,
+       .pwr_mgmt_1             = INV_MPU6050_REG_PWR_MGMT_1,
+       .pwr_mgmt_2             = INV_MPU6050_REG_PWR_MGMT_2,
+       .int_pin_cfg            = INV_MPU6050_REG_INT_PIN_CFG,
+       .accl_offset            = INV_MPU6500_REG_ACCEL_OFFSET,
+       .gyro_offset            = INV_MPU6050_REG_GYRO_OFFSET,
+};
+
 static const struct inv_mpu6050_reg_map reg_set_6050 = {
        .sample_rate_div        = INV_MPU6050_REG_SAMPLE_RATE_DIV,
        .lpf                    = INV_MPU6050_REG_CONFIG,
@@ -68,7 +88,13 @@ static const struct inv_mpu6050_chip_config chip_config_6050 = {
        .accl_fs = INV_MPU6050_FS_02G,
 };
 
-static const struct inv_mpu6050_hw hw_info[INV_NUM_PARTS] = {
+static const struct inv_mpu6050_hw hw_info[] = {
+       {
+               .num_reg = 117,
+               .name = "MPU6500",
+               .reg = &reg_set_6500,
+               .config = &chip_config_6050,
+       },
        {
                .num_reg = 117,
                .name = "MPU6050",
@@ -701,7 +727,6 @@ static int inv_check_and_setup_chip(struct inv_mpu6050_state *st)
 {
        int result;
 
-       st->chip_type = INV_MPU6050;
        st->hw  = &hw_info[st->chip_type];
        st->reg = hw_info[st->chip_type].reg;
 
@@ -737,7 +762,7 @@ static int inv_check_and_setup_chip(struct inv_mpu6050_state *st)
 }
 
 int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name,
-                      int (*inv_mpu_bus_setup)(struct iio_dev *))
+               int (*inv_mpu_bus_setup)(struct iio_dev *), int chip_type)
 {
        struct inv_mpu6050_state *st;
        struct iio_dev *indio_dev;
@@ -750,6 +775,7 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name,
                return -ENOMEM;
 
        st = iio_priv(indio_dev);
+       st->chip_type = chip_type;
        st->powerup_count = 0;
        st->irq = irq;
        st->map = regmap;
index 8d2b74eaa8b6ff8ecb3aac017db945235f929e3b..e6247c3508afac615c2a3f6517d24d5309a00f18 100644 (file)
@@ -130,7 +130,8 @@ static int inv_mpu_probe(struct i2c_client *client,
                return PTR_ERR(regmap);
        }
 
-       result = inv_mpu_core_probe(regmap, client->irq, name, NULL);
+       result = inv_mpu_core_probe(regmap, client->irq, name,
+                                   NULL, id->driver_data);
        if (result < 0)
                return result;
 
index c4e24148c733d623ca1c8d4a53e4da3dd5988004..e302a49703bf525c0f15361a586fb9ceff028631 100644 (file)
@@ -277,7 +277,7 @@ int inv_mpu6050_set_power_itg(struct inv_mpu6050_state *st, bool power_on);
 int inv_mpu_acpi_create_mux_client(struct i2c_client *client);
 void inv_mpu_acpi_delete_mux_client(struct i2c_client *client);
 int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name,
-                     int (*inv_mpu_bus_setup)(struct iio_dev *));
+               int (*inv_mpu_bus_setup)(struct iio_dev *), int chip_type);
 int inv_mpu_core_remove(struct device *dev);
 int inv_mpu6050_set_power_itg(struct inv_mpu6050_state *st, bool power_on);
 extern const struct dev_pm_ops inv_mpu_pmops;
index 5b552a677340227e498df948f5cef83693248df9..dea6c4361de013c38441100dc26078fd13393a89 100644 (file)
@@ -54,7 +54,8 @@ static int inv_mpu_probe(struct spi_device *spi)
                return PTR_ERR(regmap);
        }
 
-       return inv_mpu_core_probe(regmap, spi->irq, name, inv_mpu_i2c_disable);
+       return inv_mpu_core_probe(regmap, spi->irq, name,
+                                 inv_mpu_i2c_disable, id->driver_data);
 }
 
 static int inv_mpu_remove(struct spi_device *spi)
This page took 0.027716 seconds and 5 git commands to generate.