public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: jic23@kernel.org, linux-iio@vger.kernel.org, linux-i2c@vger.kernel.org
Subject: Re: [PATCH v2] iio: imu: inv_mpu6050: Add i2c mux for by pass
Date: Fri, 05 Dec 2014 08:03:18 -0800	[thread overview]
Message-ID: <1417795398.1851.17.camel@spandruv-desktop.jf.intel.com> (raw)
In-Reply-To: <20141205070313.GA1197@katana>

On Fri, 2014-12-05 at 08:03 +0100, Wolfram Sang wrote: 
> On Thu, Dec 04, 2014 at 03:10:25PM -0800, Srinivas Pandruvada wrote:
> > This chip allows some limited number of sensors connected to it as
> > slaves, which can be directly accessed by register interface of this
> > driver.But the current upstream driver doesn't support such mode.
> > To attach such slaves to main processor i2c bus, chip has to be set
> > up in bypass mode. This change adds i2c mux, which will enable/disable
> > this mode for transaction to/from such slave devices.
> > This was discussed for a while in mailing list, this was the outcome:
> > Reference:
> > http://www.spinics.net/lists/linux-iio/msg12126.html
> > http://comments.gmane.org/gmane.linux.kernel.iio/11470
> > 
> > Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> 
> Only minor nits, in general:
> 
> Reviewed-by: Wolfram Sang <wsa@the-dreams.de>
> 
> > +static int inv_mpu6050_create_mux(struct iio_dev *indio_dev)
> > +{
> > +	struct inv_mpu6050_state *st = iio_priv(indio_dev);
> > +	struct i2c_client *client = st->client;
> > +
> > +	st->mux_adapter = i2c_add_mux_adapter(client->adapter,
> > +					      &client->dev,
> > +					      indio_dev,
> > +					      0, 0, 0,
> > +					      inv_mpu6050_select_bypass,
> > +					      inv_mpu6050_deselect_bypass);
> > +	if (st->mux_adapter == NULL) {
> > +		dev_err(&st->client->dev, "Mux create Failed\n");
> 
> i2c_add_mux_adapter prints error messages on its own, so this is not
> needed.
> 
> > +		return -ENODEV;
> > +	}
> > +
> > +	return 0;
> > +}
> > +
> > +static void inv_mpu6050_destroy_mux(struct iio_dev *indio_dev)
> > +{
> > +	struct inv_mpu6050_state *mpu_st = iio_priv(indio_dev);
> > +
> > +	if (mpu_st->mux_adapter)
> > +		i2c_del_mux_adapter(mpu_st->mux_adapter);
> > +}
> 
> Since those two functions are only called once and don't encapsulate
> much, I'd rather put the commands directly into the calling functions.
Agree. I will move them to the caller and submit another version.
I hope, I can still use reviewed-by tag, after this change.

Thanks,
Srinivas 
> 




  reply	other threads:[~2014-12-05 16:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-04 23:10 [PATCH v2] iio: imu: inv_mpu6050: Add i2c mux for by pass Srinivas Pandruvada
2014-12-04 23:10 ` Srinivas Pandruvada
2014-12-05  7:03   ` Wolfram Sang
2014-12-05 16:03     ` Srinivas Pandruvada [this message]
2014-12-05 17:49       ` Wolfram Sang

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=1417795398.1851.17.camel@spandruv-desktop.jf.intel.com \
    --to=srinivas.pandruvada@linux.intel.com \
    --cc=jic23@kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=wsa@the-dreams.de \
    /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