Re: [PATCH v4 4/4] iio: imu: inv_mpu6050: Add SPI support for MPU6000

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Adriana,

On Wed, Feb 10, 2016 at 12:41 PM, Adriana Reus <adriana.reus@xxxxxxxxx> wrote:
> -int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name)
> +int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name,
> +                      int (*inv_mpu_bus_setup)(struct iio_dev *))
>  {
>         struct inv_mpu6050_state *st;
>         struct iio_dev *indio_dev;
> @@ -700,6 +702,9 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name)
>         if (result)
>                 return result;
>
> +       if (inv_mpu_bus_setup)
> +               inv_mpu_bus_setup(indio_dev);

ok

> +static int inv_mpu_i2c_disable(struct iio_dev *indio_dev)
> +{
> +       struct inv_mpu6050_state *st = iio_priv(indio_dev);
> +       int ret = 0;
> +
> +       ret = inv_mpu6050_set_power_itg(st, true);
> +       if (ret)
> +               return ret;
> +
> +       ret = regmap_write(st->map, INV_MPU6050_REG_USER_CTRL,
> +                             INV_MPU6050_BIT_I2C_IF_DIS);
> +       if (ret) {
> +               inv_mpu6050_set_power_itg(st, false);
> +               return ret;
> +       }

ok

> +static int inv_mpu_probe(struct spi_device *spi)
> +{
> +       struct regmap *regmap;
> +       const struct spi_device_id *id = spi_get_device_id(spi);
> +       const char *name = id ? id->name : NULL;
> +       int result;
> +
> +       regmap = devm_regmap_init_spi(spi, &inv_mpu_regmap_config);
> +       if (IS_ERR(regmap)) {
> +               dev_err(&spi->dev, "Failed to register spi regmap %d\n",
> +                       (int)PTR_ERR(regmap));
> +               return PTR_ERR(regmap);
> +       }
> +
> +       result = regmap_write(regmap, INV_MPU6050_REG_USER_CTRL,
> +                             INV_MPU6050_BIT_I2C_IF_DIS);
> +       if (result) {
> +               dev_err(&spi->dev, "Failed to disable I2C interface\n");
> +               return result;
> +       }

leftover from previous patch?


Lucas De Marchi
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux