From: Jonathan Cameron <jic23@jic23.retrosnub.co.uk>
To: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Cc: linux-iio@vger.kernel.org
Subject: Re: [PATCH 1/4] iio: imu: inv_mpu6050: use i2c mux only for chip with i2c aux bus
Date: Sun, 6 May 2018 17:49:29 +0100 [thread overview]
Message-ID: <20180506174929.33960391@archlinux> (raw)
In-Reply-To: <1525083251-8368-1-git-send-email-jmaneyrol@invensense.com>
On Mon, 30 Apr 2018 12:14:08 +0200
Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> wrote:
> icm20608 does not have i2c aux bus, so it does not make sense to
> allocate an i2c mux for this chip.
>
> Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Applied to the togreg branch of iio.git and pushed out as
testing for the autobuilders to play with it.
Thanks,
Jonathan
> ---
> drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c | 41 +++++++++++++++++++------------
> 1 file changed, 25 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
> index 90fdc5e..f11ae29 100644
> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
> @@ -125,20 +125,27 @@ static int inv_mpu_probe(struct i2c_client *client,
> return result;
>
> st = iio_priv(dev_get_drvdata(&client->dev));
> - st->muxc = i2c_mux_alloc(client->adapter, &client->dev,
> - 1, 0, I2C_MUX_LOCKED | I2C_MUX_GATE,
> - inv_mpu6050_select_bypass,
> - inv_mpu6050_deselect_bypass);
> - if (!st->muxc)
> - return -ENOMEM;
> - st->muxc->priv = dev_get_drvdata(&client->dev);
> - result = i2c_mux_add_adapter(st->muxc, 0, 0, 0);
> - if (result)
> - return result;
> -
> - result = inv_mpu_acpi_create_mux_client(client);
> - if (result)
> - goto out_del_mux;
> + switch (st->chip_type) {
> + case INV_ICM20608:
> + /* no i2c auxiliary bus on the chip */
> + break;
> + default:
> + /* declare i2c auxiliary bus */
> + st->muxc = i2c_mux_alloc(client->adapter, &client->dev,
> + 1, 0, I2C_MUX_LOCKED | I2C_MUX_GATE,
> + inv_mpu6050_select_bypass,
> + inv_mpu6050_deselect_bypass);
> + if (!st->muxc)
> + return -ENOMEM;
> + st->muxc->priv = dev_get_drvdata(&client->dev);
> + result = i2c_mux_add_adapter(st->muxc, 0, 0, 0);
> + if (result)
> + return result;
> + result = inv_mpu_acpi_create_mux_client(client);
> + if (result)
> + goto out_del_mux;
> + break;
> + }
>
> return 0;
>
> @@ -152,8 +159,10 @@ static int inv_mpu_remove(struct i2c_client *client)
> struct iio_dev *indio_dev = i2c_get_clientdata(client);
> struct inv_mpu6050_state *st = iio_priv(indio_dev);
>
> - inv_mpu_acpi_delete_mux_client(client);
> - i2c_mux_del_adapters(st->muxc);
> + if (st->muxc) {
> + inv_mpu_acpi_delete_mux_client(client);
> + i2c_mux_del_adapters(st->muxc);
> + }
>
> return 0;
> }
prev parent reply other threads:[~2018-05-06 16:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-30 10:14 [PATCH 1/4] iio: imu: inv_mpu6050: use i2c mux only for chip with i2c aux bus Jean-Baptiste Maneyrol
2018-04-30 10:14 ` [PATCH 2/4] iio: imu: inv_mpu6050: fix possible deadlock between mutex and iio Jean-Baptiste Maneyrol
2018-05-06 16:55 ` Jonathan Cameron
2018-04-30 10:14 ` [PATCH 3/4] iio: imu: inv_mpu6050: skip first sample when gyro is on Jean-Baptiste Maneyrol
2018-05-06 17:00 ` Jonathan Cameron
2018-05-08 14:40 ` Jean-Baptiste Maneyrol
2018-05-12 9:38 ` Jonathan Cameron
2018-04-30 10:14 ` [PATCH 4/4] iio: imu: inv_mpu6050: fix user_ctrl register overwritten Jean-Baptiste Maneyrol
2018-05-06 17:01 ` Jonathan Cameron
2018-05-06 16:49 ` Jonathan Cameron [this message]
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=20180506174929.33960391@archlinux \
--to=jic23@jic23.retrosnub.co.uk \
--cc=jmaneyrol@invensense.com \
--cc=linux-iio@vger.kernel.org \
/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).