linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Matt Ranostay <matt.ranostay@intel.com>
Cc: linux-iio@vger.kernel.org, daniel.baluta@intel.com,
	adriana.reus@intel.com
Subject: Re: [PATCH 5/5] iio: imu: mpu6050: add mpu6500 register settings
Date: Thu, 25 Feb 2016 19:56:12 +0000	[thread overview]
Message-ID: <56CF5C5C.2000902@kernel.org> (raw)
In-Reply-To: <1456177151-15881-6-git-send-email-matt.ranostay@intel.com>

On 22/02/16 21:39, Matt Ranostay wrote:
> Signed-off-by: Matt Ranostay <matt.ranostay@intel.com>
Applied to the togreg branch of iio.git - initially pushed out as testing for
the autobuilders to play with it.

Thanks,
Jonathan
> ---
>  drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 32 +++++++++++++++++++++++++++---
>  drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c  |  3 ++-
>  drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h  |  2 +-
>  drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c  |  3 ++-
>  4 files changed, 34 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> index 3acf0863e558..75d93181a16d 100644
> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> @@ -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",
> @@ -692,7 +718,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;
>  
> @@ -726,7 +751,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;
> @@ -739,6 +764,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;
> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
> index 37cc16d3fca3..37aec63113ed 100644
> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
> @@ -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;
>  
> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h b/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h
> index c4e24148c733..e302a49703bf 100644
> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h
> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h
> @@ -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;
> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c
> index 5b552a677340..dea6c4361de0 100644
> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c
> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c
> @@ -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)
> 


  reply	other threads:[~2016-02-25 19:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-22 21:39 [PATCH 0/5] mpu6050: code clean and calibration support Matt Ranostay
2016-02-22 21:39 ` [PATCH 1/5] iio: imu: mpu6050: use inv_mpu6050_sensor_show return code Matt Ranostay
2016-02-22 21:49   ` Daniel Baluta
2016-02-22 21:50     ` Daniel Baluta
2016-02-25 19:50   ` Jonathan Cameron
2016-02-22 21:39 ` [PATCH 2/5] iio: imu: mpu6050: fix INV_MPU6050_REG_UP_TIME delay Matt Ranostay
2016-02-25 19:54   ` Jonathan Cameron
2016-02-22 21:39 ` [PATCH 3/5] iio: imu: mpu6050: add missing docstring for int_pin_cfg Matt Ranostay
2016-02-25 19:55   ` Jonathan Cameron
2016-02-22 21:39 ` [PATCH 4/5] iio: imu: mpu6050: add calibration offset support Matt Ranostay
2016-02-25 19:55   ` Jonathan Cameron
2016-02-22 21:39 ` [PATCH 5/5] iio: imu: mpu6050: add mpu6500 register settings Matt Ranostay
2016-02-25 19:56   ` Jonathan Cameron [this message]
2016-02-24 21:08 ` [PATCH 0/5] mpu6050: code clean and calibration support Jonathan Cameron
     [not found]   ` <DM3PR1201MB1072776083BB71F4F618555CAFA50@DM3PR1201MB1072.namprd12.prod.outlook.com>
2016-02-25  8:45     ` Daniel Baluta
2016-02-25 15:36       ` Ge Gao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56CF5C5C.2000902@kernel.org \
    --to=jic23@kernel.org \
    --cc=adriana.reus@intel.com \
    --cc=daniel.baluta@intel.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=matt.ranostay@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).