linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <guenter.roeck-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org>
To: Peter Korsgaard <jacmet-OfajU3CKLf1/SzgSGea1oA@public.gmane.org>
Cc: "linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: Using the gpio i2c multiplexer driver
Date: Wed, 16 Feb 2011 15:50:15 -0800	[thread overview]
Message-ID: <20110216235015.GA16412@ericsson.com> (raw)
In-Reply-To: <87ei789z3g.fsf-uXGAPMMVk8amE9MCos8gUmSdvHPH+/yF@public.gmane.org>

On Wed, Feb 16, 2011 at 03:13:07AM -0500, Peter Korsgaard wrote:
> >>>>> "Guenter" == Guenter Roeck <guenter.roeck-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org> writes:
> 
>  Guenter> Hi all,
> 
>  Guenter> I am trying to use the new GPIO based I2C
>  Guenter> multiplexer. Unfortunately, I have an initialization problem
>  Guenter> with it.
> 
>  Guenter> Some time after registering the multiplexer as platform driver, its
>  Guenter> probe function is called. Unfortunately, that does not happen in sync
>  Guenter> with I2C adapter initialization. The GPIO mux probe function is called
>  Guenter> before the parent's (ie the multiplexed I2C adapter) probe function is
>  Guenter> called. As a result, the GPIO mux driver does not find its parent i2c
>  Guenter> adapter, and the probe function aborts with an error.
> 
>  Guenter> Any idea how I I can fix the problem, ie how I can ensure that
>  Guenter> the GPIO mux probe function is only called after its parent
>  Guenter> I2C adapter is initialized ?
> 
> What i2c bus controller are you using? Are you registering it's platform
> data very late (E.G. after you register the platform data for gpiomux)?
> 
> If you do register the platform data in the correct order, things SHOULD
> work correctly as busses are listed in drivers/i2c/Makefile before
> muxes, but alternatively you could play with the init order (E.G. use
> subsys_initcall instead of module_init in the bus driver, see
> b8680784875 for an example).
> 
Turns out
	 bus_register_notifier(&i2c_bus_type, &my_bus_notifier);
is my friend here.

Wait for the i2c adapter to be registered, which results in a notifier call.
Then register the mux driver from the notifier function.

Guenter

      parent reply	other threads:[~2011-02-16 23:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-15 22:47 Using the gpio i2c multiplexer driver Guenter Roeck
2011-02-16  7:07 ` Michael Lawnick
     [not found]   ` <4D5B77AE.20307-Mmb7MZpHnFY@public.gmane.org>
2011-02-16 14:29     ` Guenter Roeck
2011-02-16  8:13 ` Peter Korsgaard
     [not found]   ` <87ei789z3g.fsf-uXGAPMMVk8amE9MCos8gUmSdvHPH+/yF@public.gmane.org>
2011-02-16 14:28     ` Guenter Roeck
2011-02-16 23:50     ` Guenter Roeck [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=20110216235015.GA16412@ericsson.com \
    --to=guenter.roeck-izefyvvap7pwk0htik3j/w@public.gmane.org \
    --cc=jacmet-OfajU3CKLf1/SzgSGea1oA@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@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).