linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* pca953x GPIO
@ 2010-06-23 12:02 Giampaolo Bellini
       [not found] ` <AANLkTik5ICmrrsX0m9qzPr7TzF44HKIr5FMC4eKeGkzZ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Giampaolo Bellini @ 2010-06-23 12:02 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA

Hi all...

  I'm new to I2c and I'm in trouble trying to get GPIO works on an
Advantech PCM-3362 motherboard.

manufacturer says that GPIO controller is an NXP PCA9555PW chip,
attached to the i2c BUS; the chip has the addresses 40 (read) and 41
(write) but, if I'm not wrong, in his linux libsusi library
manufacturer access GPIO via BIOS calls and not via linux i2c.

CPU is an intel Atom N450 with ICH8M chipset and it seems that SMBUS
controller is correctly recognized by the kernel as dmegs reports
something like:
i801_smbus 0000:00:1f.3: PCI INT C -> GSI 17 (level, low) -> IRQ 17

actually I've configured the latest 2.6.34 kernel with i2c and pca953x
drivers, but /sys/class/gpio reports only import / export entries,
with no GPIO chips at all...

I've read Documents/gpio.txt but still don't understand if I have to
do something more to enable GPIO: as I want to access it from kernel
space, I think I'll need to write my own driver (calling
gpio_request() etc) but still miss info about GPIO numbers... and I'm
not even sure GPIO is currently detected.

Ive try also registering a new GPIO device using generic gpiolib &
sysfs support (eg: echo GPIO-RD 0x40 >
/sys/bus/i2c/devices/i2c-0/new_device) but with no success.


   thanks a lot for any ideas

             Giampaolo Bellini

^ permalink raw reply	[flat|nested] 13+ messages in thread
* Re: pca953x GPIO
@ 2010-12-17 17:21 Joan Pau Beltran
       [not found] ` <4D0B9C35.5000802-i5CWTa81U/w@public.gmane.org>
       [not found] ` <AANLkTi=LQ56S43=BL8tdo=MakP-PRzVK0ieJM07y_O_1@mail.gmail.com>
  0 siblings, 2 replies; 13+ messages in thread
From: Joan Pau Beltran @ 2010-12-17 17:21 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA

Hi everyone,

We are also working with an Advantech PCM3362 board in an underwater 
vehicle, and want to use the GPIO port to monitor the battery charge (a 
battery board is connected to the GPIO port and sets a pin to 1 when 
voltage goes below 20V).

We need to use Ubuntu, currently 10.04 with kernel 
linux-image-2.6-32-26-generic.

As Giampolo says, out of the box there aren't any chips under 
/sys/class/gpio (only import/export files).
After checking that i2c-gpio and pca953x are shipped with the kernel but 
no loaded by default, I tried to modprobe them and they load 
successfully, but the chip does not appear in /sys/class/gpio.
i2cdetect does not list any bus.

The battery board is not connected to the GPIO now. Actually nothing is 
connected to it. I suppose that the chip should be detected even if 
there is nothing attached to it. But just to be sure, do I need to 
connect it to some device to get the chip appear under /sys/class/gpio?

Giampolo (ore anyone on the list), did you success using the GPIO port 
on that board? In that case, could you point me what steps have you 
done? It's the first time I use a GPIO port and I read the Documentation 
and both examples pointed out by Jean but still can not figure out why 
the chip is not recognized under /sys/class/gpio or how to access it.

Thanks Jean for pointing out about the address alignment difference in 
Linux. For sure I won't even thought about it reading the Advantech manual.

Thanks in advance, and please excuse my English!

^ permalink raw reply	[flat|nested] 13+ messages in thread
* Re: pca953x GPIO
@ 2010-12-24 16:15 Joan Pau Beltran
       [not found] ` <4D14C735.8-i5CWTa81U/w@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Joan Pau Beltran @ 2010-12-24 16:15 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA

Thank you very much Jean and Giampolo.

After reading again the kernel GPIO Documentation, I have some doubts 
that I would like to resolve and any word about them would be 
apreciated. Please excuse me if the following questions seem too obvious 
or are wrong formulated. I am very new to I2C and GPIO and can not get 
much more information from the results of my searches.

 From Jean's words and the following citation in the GPIO Documentation

> 523    Board Support
> 524    -------------
> 525    For external GPIO controllers -- such as I2C or SPI expanders, 
> ASICs, multi
> 526    function devices, FPGAs or CPLDs -- most often board-specific 
> code handles
> 527    registering controller devices and ensures that their drivers 
> know what GPIO
> 528    numbers to use with gpiochip_add().  Their numbers often start 
> right after
> 529    platform-specific GPIOs.
> 530
> 531    For example, board setup code could create structures 
> identifying the range
> 532    of GPIOs that chip will expose, and passes them to each GPIO 
> expander chip
> 533    using platform_data.  Then the chip driver's probe() routine 
> could pass that
> 534    data to gpiochip_add().


This platform-specific code is what Jean refers to, and must be compiled 
into the kernel.
If this is right, do we need to recompile the whole kernel with the new 
code for your board, or we can compile only the code for a particular 
board and load it as a module? And then, how can we access to the GPIO 
pins from a userspace program?

In several pages I have read three different modules are mentioned, 
namely pca953x, i2c-dev and i2c-gpio. Could anybody clarify what is the 
exact function of each of these modules, please?

Does the pca953x just use the previous platform code and the general 
GPIO support kernel facilities to expose the GPIO chip in the user space 
under /sys/class/gpio ?

Does the i2c-dev module give an alternative way to access to a generic 
i2c device via i2cget? If this is true, how can we access the GPIO pins 
from a program in that case?

What does the i2c-gpio module do?

Thanks everyone in advance.

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

end of thread, other threads:[~2011-12-21 17:02 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-23 12:02 pca953x GPIO Giampaolo Bellini
     [not found] ` <AANLkTik5ICmrrsX0m9qzPr7TzF44HKIr5FMC4eKeGkzZ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-06-24  9:49   ` Jean Delvare
     [not found]     ` <20100624114937.23bb3efc-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2010-06-24 17:49       ` Giampaolo Bellini
     [not found]         ` <AANLkTikhwn0l3nK-a-4TfP-mHcJxwvw7bxe2mKyya61A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-06-24 19:01           ` Jean Delvare
  -- strict thread matches above, loose matches on Subject: below --
2010-12-17 17:21 Joan Pau Beltran
     [not found] ` <4D0B9C35.5000802-i5CWTa81U/w@public.gmane.org>
2010-12-17 18:23   ` Jean Delvare
     [not found] ` <AANLkTi=LQ56S43=BL8tdo=MakP-PRzVK0ieJM07y_O_1@mail.gmail.com>
     [not found]   ` <AANLkTi=LQ56S43=BL8tdo=MakP-PRzVK0ieJM07y_O_1-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-12-24 16:14     ` Joan Pau Beltran
     [not found]       ` <AANLkTinSuVYAVQqPHRtrnTPrtEZA1aCHOb6X4H8u2OW1@mail.gmail.com>
     [not found]         ` <AANLkTinSuVYAVQqPHRtrnTPrtEZA1aCHOb6X4H8u2OW1-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-12-28 16:04           ` Joan Pau Beltran
     [not found]             ` <4D1A0A95.7020408-i5CWTa81U/w@public.gmane.org>
2011-01-06 15:22               ` Jean Delvare
     [not found]             ` <20110106162213.4e5ee5b4@endymion.del vare>
     [not found]               ` <20110106162213.4e5ee5b4-R0o5gVi9kd4wFzbXFV0ICA@public.gmane.org vare>
2011-01-07 17:34                 ` Joan Pau Beltran
     [not found]                   ` <4D274E8B.8050600-i5CWTa81U/w@public.gmane.org>
2011-12-21 17:02                     ` Joan Pau Beltran
2010-12-24 16:15 Joan Pau Beltran
     [not found] ` <4D14C735.8-i5CWTa81U/w@public.gmane.org>
2011-01-06 16:19   ` Jean Delvare

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