linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* i2c Device Detection
@ 2010-12-16 14:20 Gerard Pierre
       [not found] ` <AANLkTi=arobgyX-FgCV572AbY3N+6pRgsM+Fr2moQ2i6-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Gerard Pierre @ 2010-12-16 14:20 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA

Greetings,

Being relatively new to i2c I wanted to verify that my conclusion
reached from doing some initial reading on i2c device detection is
accurate:

Based on the nature of an i2c bus there is no automatic detection of
an i2c device "plugged into" a system in the kernel. For example, an
embedded Linux system boots up and 10 minutes later someone attaches a
smart battery to the running system (to a bus that also has a smart
battery charger, for example) - there is no way to automatically
detect the device and run some initialization code in a device driver
every time the battery gets connected to the i2c bus, correct?

Regards,
Gerard

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: i2c Device Detection
       [not found] ` <AANLkTi=arobgyX-FgCV572AbY3N+6pRgsM+Fr2moQ2i6-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2010-12-16 15:36   ` Jean Delvare
       [not found]     ` <20101216163613.0c80ec04-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Jean Delvare @ 2010-12-16 15:36 UTC (permalink / raw)
  To: Gerard Pierre; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA

Bonjour Gerard,

On Thu, 16 Dec 2010 09:20:00 -0500, Gerard Pierre wrote:
> Being relatively new to i2c I wanted to verify that my conclusion
> reached from doing some initial reading on i2c device detection is
> accurate:
> 
> Based on the nature of an i2c bus there is no automatic detection of
> an i2c device "plugged into" a system in the kernel. For example, an
> embedded Linux system boots up and 10 minutes later someone attaches a
> smart battery to the running system (to a bus that also has a smart
> battery charger, for example) - there is no way to automatically
> detect the device and run some initialization code in a device driver
> every time the battery gets connected to the i2c bus, correct?

Correct. You'll need a side-band mechanism for the notification. For
example, inserting the battery could push on a switch, triggering an
interrupt.

An alternative would be to poll continuously for the slave I2C address
of the battery, but that would be horrible performance-wise and thus
better avoided.

-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: i2c Device Detection
       [not found]     ` <20101216163613.0c80ec04-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
@ 2010-12-16 15:46       ` Ben Dooks
  0 siblings, 0 replies; 3+ messages in thread
From: Ben Dooks @ 2010-12-16 15:46 UTC (permalink / raw)
  To: Jean Delvare; +Cc: Gerard Pierre, linux-i2c-u79uwXL29TY76Z2rM5mHXA

On Thu, Dec 16, 2010 at 04:36:13PM +0100, Jean Delvare wrote:
> Bonjour Gerard,
> 
> On Thu, 16 Dec 2010 09:20:00 -0500, Gerard Pierre wrote:
> > Being relatively new to i2c I wanted to verify that my conclusion
> > reached from doing some initial reading on i2c device detection is
> > accurate:
> > 
> > Based on the nature of an i2c bus there is no automatic detection of
> > an i2c device "plugged into" a system in the kernel. For example, an
> > embedded Linux system boots up and 10 minutes later someone attaches a
> > smart battery to the running system (to a bus that also has a smart
> > battery charger, for example) - there is no way to automatically
> > detect the device and run some initialization code in a device driver
> > every time the battery gets connected to the i2c bus, correct?
> 
> Correct. You'll need a side-band mechanism for the notification. For
> example, inserting the battery could push on a switch, triggering an
> interrupt.

Yes, something like a gpio-key driver could for gpios or similar, as you
could have a userspace daemon waiting on input. Or you could do something
similar which launches a userspace helper, or your own in-kernel thing
if you really wanted.

Depends on userland, how much work you want to do, etc.
 
> An alternative would be to poll continuously for the slave I2C address
> of the battery, but that would be horrible performance-wise and thus
> better avoided.

Depends on the controller and how often you want to poll for it being
there... most modern systems with hardware i2c blocks can send an address
with just one interrupt (and all you're looking for is an ack)

-- 
Ben Dooks, ben-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org, http://www.fluff.org/ben/

Large Hadron Colada: A large Pina Colada that makes the universe disappear.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-12-16 15:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-16 14:20 i2c Device Detection Gerard Pierre
     [not found] ` <AANLkTi=arobgyX-FgCV572AbY3N+6pRgsM+Fr2moQ2i6-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-12-16 15:36   ` Jean Delvare
     [not found]     ` <20101216163613.0c80ec04-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2010-12-16 15:46       ` Ben Dooks

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).