Skip to contentSkip to conversation

linux gpio

DISCUSSION Jürgen Lambrecht 2 participants 3 messages Mar 29, 2011 – Apr 4, 2011

lore
Share & tools
lore
#0 lore raw

Hello,

I am new to linux (coming from eCos).
My backlight driver does not start up because the reset gpio pin is not correct specified.
How does gpio work in Linux?

I have 2 platforms that use the same backlight driver, under arm, for freescale imx: imx31_3ds and imx27_3ds. I don't think that matters, I just need to understand the linux gpio.

The imx31 platform gives the number 88 as gpio number to the backlight driver.
That number comes out of 'iomux-mx3.h'.
In 'iomux-mx27.h' the GPIO's are specified in an other way, the "hardware" way, specifying bank and port. I think Linux GPIO needs a sort of general gpio number.
But how do I calculate that number out of the datasheet?
In the imx31 datasheet, I cannot find that number 88 (or the other numbers in 'iomux-mx3.h').

Kind regards,
J?rgen

Signature · 6 lines
J?rgen Lambrecht
R&D Associate
Tel: +32 (0)51 303045    Fax: +32 (0)51 310670
http://www.televic-rail.com
Televic Rail NV - Leo Bekaertlaan 1 - 8870 Izegem - Belgium
Company number 0825.539.581 - RPR Kortrijk
#1 lore raw

2011/3/29 J?rgen Lambrecht <[email protected]>:

Quoted 7 lines

Hello,

I am new to linux (coming from eCos).
My backlight driver does not start up because the reset gpio pin is not correct specified.
How does gpio work in Linux?

theres no single way.
the new way is in drivers/gpio/* , implemented in gpiolib.c defined in #include <linux/gpio.h>

there are also char drivers, with which Im more familiar. ./char/nsc_gpio.c
./char/pc8736x_gpio.c
./char/scx200_gpio.c

Quoted 9 lines

I have 2 platforms that use the same backlight driver, under arm, for freescale imx: imx31_3ds and imx27_3ds. I don't think that matters, I just need to understand the linux gpio.

The imx31 platform gives the number 88 as gpio number to the backlight driver.
That number comes out of 'iomux-mx3.h'.
In 'iomux-mx27.h' the GPIO's are specified in an other way, the "hardware" way, specifying bank and port. I think Linux GPIO needs a sort of general gpio number.

The problem here is that board IDs are somewhat arbitrary, whereas driver IDs are predictable. Take soekris 4801 as an example; it has gpio on the CPU-SOC (scx200_gpio), and on a peripheral chip (pc8736x_gpio)
The board uses CPU pins for Leds (and reset button I think), but the GPIO exposed to connector is on pc87366 chip.
The char drivers use major device numbers to select the chip & driver, and minor numbers to select the bank/pin on the chip.
THis lets users create device files with suitable names / numbers.

Quoted 4 lines

But how do I calculate that number out of the datasheet? In the imx31 datasheet, I cannot find that number 88 (or the other numbers in 'iomux-mx3.h').

what driver supports your boards ?
is it a new gpio driver ?

Quoted 17 lines

Kind regards,
J?rgen

--
J?rgen Lambrecht
R&D Associate
Tel: +32 (0)51 303045 ? ?Fax: +32 (0)51 310670
http://www.televic-rail.com
Televic Rail NV - Leo Bekaertlaan 1 - 8870 Izegem - Belgium Company number 0825.539.581 - RPR Kortrijk

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

#2 lore raw
Quoted 11 lines · Jim Cromie

2011/3/29 J?rgen Lambrecht<[email protected]>:

Quoted 7 lines

Hello,

I am new to linux (coming from eCos).
My backlight driver does not start up because the reset gpio pin is not correct specified.
How does gpio work in Linux?

theres no single way.
the new way is in drivers/gpio/* , implemented in gpiolib.c defined in #include<linux/gpio.h>

thanks, i'll use that to write a gpio driver for our own hw.

Quoted 16 lines

there are also char drivers, with which Im more familiar. ./char/nsc_gpio.c
./char/pc8736x_gpio.c
./char/scx200_gpio.c

Quoted 9 lines

I have 2 platforms that use the same backlight driver, under arm, for freescale imx: imx31_3ds and imx27_3ds. I don't think that matters, I just need to understand the linux gpio.

The imx31 platform gives the number 88 as gpio number to the backlight driver.
That number comes out of 'iomux-mx3.h'.
In 'iomux-mx27.h' the GPIO's are specified in an other way, the "hardware" way, specifying bank and port. I think Linux GPIO needs a sort of general gpio number.

Quoted 10 lines

The problem here is that board IDs are somewhat arbitrary, whereas driver IDs are predictable. Take soekris 4801 as an example; it has gpio on the CPU-SOC (scx200_gpio), and on a peripheral chip (pc8736x_gpio)
The board uses CPU pins for Leds (and reset button I think), but the GPIO exposed to connector is on pc87366 chip.
The char drivers use major device numbers to select the chip& driver, and minor numbers to select the bank/pin on the chip.
THis lets users create device files with suitable names / numbers.

ok, interesting

Quoted 6 lines
Quoted 4 lines

But how do I calculate that number out of the datasheet? In the imx31 datasheet, I cannot find that number 88 (or the other numbers in 'iomux-mx3.h').

what driver supports your boards ?
is it a new gpio driver ?

It is ok now: i found it in arch/arm/plat-mxc/include/mach/gpio.h. Thanks, the backlight driver starts up now.
Now I'm looking why udev (or mdev) does not create a /dev/fb0.. reading about it..

Kind regards,
J?rgen

Signature · 6 lines
J?rgen Lambrecht
R&D Associate
Tel: +32 (0)51 303045    Fax: +32 (0)51 310670
http://www.televic-rail.com
Televic Rail NV - Leo Bekaertlaan 1 - 8870 Izegem - Belgium
Company number 0825.539.581 - RPR Kortrijk