linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
To: Peter Korsgaard
	<peter.korsgaard-ob4gmnvZ1/cAvxtiuMwx3w@public.gmane.org>
Cc: Mark Brown
	<broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>,
	Linux I2C <linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: i2c-mux-gpio platform device ID issue
Date: Thu, 26 Jul 2012 09:28:14 +0200	[thread overview]
Message-ID: <20120726092814.2689a30f@endymion.delvare> (raw)
In-Reply-To: <20120725144409.1e47bd95-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>

Hi again Peter and Mark,

On Wed, 25 Jul 2012 14:44:09 +0200, Jean Delvare wrote:
> If a per-driver IDA isn't acceptable, then we can go for a global IDA,
> but then we can't re-use pdev->id == -1 for it. We'd have to introduce
> pdev->id == -2 for drivers which want a dynamically allocated unique
> ID. Actually this might be a better approach, as it's less intrusive.

I slept on it and came up with what I think is an easier and more
elegant solution. We could simply agree on using GPIO pin numbers as
platform device IDs, as two i2c-gpio-mux instances can't control the
same GPIO pin.

* * * * *

From: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
Subject: i2c-mux-gpio: Document what device ID to use

We need a convention for i2c-mux-gpio platform device IDs so that they
do not collide.

Signed-off-by: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
Cc: Peter Korsgaard <peter.korsgaard-ob4gmnvZ1/cAvxtiuMwx3w@public.gmane.org>
---
 Documentation/i2c/muxes/i2c-mux-gpio |    7 +++++++
 1 file changed, 7 insertions(+)

--- linux-3.5.orig/Documentation/i2c/muxes/i2c-mux-gpio	2012-07-21 22:58:29.000000000 +0200
+++ linux-3.5/Documentation/i2c/muxes/i2c-mux-gpio	2012-07-26 08:41:23.291014194 +0200
@@ -63,3 +63,10 @@ static struct platform_device myboard_i2
 		.platform_data	= &myboard_i2cmux_data,
 	},
 };
+
+Device Registration
+-------------------
+
+When registering your i2c-gpio-mux device, you should pass the number
+of any GPIO pin it uses as the device ID. This guarantees that every
+instance has a different ID.


-- 
Jean Delvare

  parent reply	other threads:[~2012-07-26  7:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-25 12:44 i2c-mux-gpio platform device ID issue Jean Delvare
     [not found] ` <20120725144409.1e47bd95-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-07-25 14:39   ` Jean Delvare
     [not found]     ` <20120725163913.60fffd1a-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-07-25 19:32       ` Mark Brown
     [not found]         ` <20120725193243.GA9792-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2012-07-25 21:37           ` Jean Delvare
     [not found]             ` <20120725233727.55693faf-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-07-25 21:47               ` Mark Brown
2012-07-26  7:28   ` Jean Delvare [this message]
     [not found]     ` <20120726092814.2689a30f-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-07-26 11:49       ` Jean Delvare

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=20120726092814.2689a30f@endymion.delvare \
    --to=khali-puyad+kwke1g9huczpvpmw@public.gmane.org \
    --cc=broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=peter.korsgaard-ob4gmnvZ1/cAvxtiuMwx3w@public.gmane.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).