linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Finding particular I2C adapter?
@ 2011-10-07 12:43 Przemyslaw Wegrzyn
       [not found] ` <4E8EF3DC.7060704-qaBtZ/OuEkOiu113P13oHA@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Przemyslaw Wegrzyn @ 2011-10-07 12:43 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA

Hi!

First of all - I know what I'm asking for is somewhat "broken by
design", but anyway...

I'm about to develop a driver for a custom chip attached to SMBus in a
sort of industrial PC (choosing SMBus was a really bad idea, imho, but
unfortunately I can't change hardware team decisions).

While developing the I2C client driver seems pretty straight-forward,
I'm slightly confused about making it look for the device on a
particular I2C adapter instance. The project is limited to particular
board types, each using ICH chipset, so I need to use i2c_adapter
controlled by i2c-i801 module.

Here's my understanding so far:

- it is not an embedded system in a strict sense -> thus no
i2c_board_info -> no static I2C configuration

- AFAIR I can force the bus and address using 'force' parameter at
module loading time (e.g. via /etc/modules), but the I2C adapter number
is not static anyway on PC, and depend on e.g. adapter modules loading
order, so I'm a bit afraid of users breaking this configuration too easily.

- similar issue with echo'ing to /sys/bus/i2c/devices/i2c-<n>/new_device
- I need to know the bus ID in advance

Ideally, I'd like to have a sort of wrapper module that will find the
proper i2c_adapter and instantiate my i2c_client explicitly. Yet I know
that iterating i2c adapters is discouraged at least (actually, is there
any API now allowing for this? calling i2c_get_adapter with successive
numbers is clearly a hack).

Any ideas?

BR,
Przemek

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

* Re: Finding particular I2C adapter?
       [not found] ` <4E8EF3DC.7060704-qaBtZ/OuEkOiu113P13oHA@public.gmane.org>
@ 2011-10-10 12:20   ` Przemyslaw Wegrzyn
  0 siblings, 0 replies; 2+ messages in thread
From: Przemyslaw Wegrzyn @ 2011-10-10 12:20 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA

On 10/07/2011 02:43 PM, Przemyslaw Wegrzyn wrote:
> Ideally, I'd like to have a sort of wrapper module that will find the
> proper i2c_adapter and instantiate my i2c_client explicitly. Yet I know
> that iterating i2c adapters is discouraged at least (actually, is there
> any API now allowing for this? calling i2c_get_adapter with successive
> numbers is clearly a hack).
Answering my own question - there's i2c_for_each_dev() that I've
overlooked before. Still a hack, anyway.

--
Przemek

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

end of thread, other threads:[~2011-10-10 12:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-07 12:43 Finding particular I2C adapter? Przemyslaw Wegrzyn
     [not found] ` <4E8EF3DC.7060704-qaBtZ/OuEkOiu113P13oHA@public.gmane.org>
2011-10-10 12:20   ` Przemyslaw Wegrzyn

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