Use LCD pin for GPIO in iMX28

キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

Use LCD pin for GPIO in iMX28

2,033件の閲覧回数
emanuelec
Contributor III

I'm newbie in iMX28 Linux programming. I use a LCD display with color depth 18bit. So I have 4 pins unused who I want use they like GPIO pins (from LCD_D08 to LDC_D11).

In mx28evk_pins.c I configured these pins in this manner (struct pin_desc):

.name = "nyname",

.id = PINID_LCD_D08,

.fun = PIN_GPIO,

.voltage = PAD_£_£V,

.output = 0,

and I call the function

mx28evk_init_pin_group(...,...)

and before I export these pins:

gpio_export(MXS_PIN_TO_GPIO(PINID_LCD_D08), false);

When Linux starts I see this error message for each pin:

WARNING: at drivers/gpio/gpiolib.c:103 gpio_ensure_requested+0x58/0x120()

autorequest GPIO-40

Modules linked in:

Backtrace:

[<c0032468>] (dump_backtrace+0x0/0x114) from [<c039930c>] (dump_stack+0x18/0x1c)

r7:00000009 r6:00000067 r5:c0222300 r4:c7c27ee8

[<c03992f4>] (dump_stack+0x0/0x1c) from [<c004a448>] (warn_slowpath_common+0x54/0x6c)

[<c004a3f4>] (warn_slowpath_common+0x0/0x6c) from [<c004a504>] (warn_slowpath_fmt+0x38/0x40)

r9:00000000 r8:00000000 r7:00000000 r6:00000028 r5:c04c09b0

r4:c051c080

[<c004a4cc>] (warn_slowpath_fmt+0x0/0x40) from [<c0222300>] (gpio_ensure_requested+0x58/0x120)

r3:00000028 r2:c0469f60

[<c02222a8>] (gpio_ensure_requested+0x0/0x120) from [<c02226cc>] (gpio_direction_input+0x8c/0x154)

r7:c051c080 r6:00000008 r5:60000013 r4:c04c09b0

[<c0222640>] (gpio_direction_input+0x0/0x154) from [<c000e6d4>] (mx28evk_init_pin_group+0xfc/0x114)

r9:00000000 r8:00000000 r7:00000000 r6:c04c0818 r5:c04c0818

r4:00000000

[<c000e5d8>] (mx28evk_init_pin_group+0x0/0x114) from [<c000e778>] (mx28evk_pins_init+0x8c/0x188)

[<c000e6ec>] (mx28evk_pins_init+0x0/0x188) from [<c000e4e4>] (mx28evk_init_machine+0x24/0xac)

[<c000e4c0>] (mx28evk_init_machine+0x0/0xac) from [<c000b5c4>] (customize_machine+0x20/0x2c)

[<c000b5a4>] (customize_machine+0x0/0x2c) from [<c002e3ac>] (do_one_initcall+0x64/0x1cc)

[<c002e348>] (do_one_initcall+0x0/0x1cc) from [<c0008484>] (kernel_init+0xb4/0x170)

r9:00000000 r8:00000000 r7:00000013 r6:c004de48 r5:c0027e1c

r4:c002794c

[<c00083d0>] (kernel_init+0x0/0x170) from [<c004de48>] (do_exit+0x0/0x6dc)

r5:c00083d0 r4:00000000

---[ end trace 1b75b31a2719ed1c ]---


Is it possible to use these pins as GPIO? Do I change boot stream configuration (for example because there are some register one time writable)?

Thanks

ラベル(2)
2 返答(返信)

472件の閲覧回数
YS
Contributor IV

I'm not sure but I believe it is warning message which says you haven't explicitly called gpio_request. The call tree shows

mx28evk_pins_init -> mx28evk_init_pin_group -> gpio_direction_input -> gpio_ensure_requested

Then warning message "WARNING: at drivers/gpio/gpiolib.c:103 gpio_ensure_requested+0x58/0x120()...autorequest GPIO-40" happens.

Take a look at drivers/gpio/gpiolib.c. gpio_ensure_requested() has detailed comment of intention of this function (which is not very commin in Linux Kernel code, though).

/* Warn when drivers omit gpio_request() calls -- legal but ill-advised

* when setting direction, and otherwise illegal.  Until board setup code

* and drivers use explicit requests everywhere (which won't happen when

* those calls have no teeth) we can't avoid autorequesting.  This nag

* message should motivate switching to explicit requests... so should

* the weaker cleanup after faults, compared to gpio_request().

*

* NOTE: the autorequest mechanism is going away; at this point it's

* only "legal" in the sense that (old) code using it won't break yet,

* but instead only triggers a WARN() stack dump.

*/

Which is strange, as long as you define .fun=PIN_GPIO and called mx28evk_init_pin_group(), gpio_request(MXS_PIN_TO_GPIO(pin->id), pin->name); must be already called before  gpio_direction_input().

Perhaps your gpio_request() is rejected for some reason? I recommend to insert printk() to see what happend.

                if (pin->fun == PIN_GPIO) {

                        int ret;

                        ret = gpio_request(MXS_PIN_TO_GPIO(pin->id), pin->name);

                        if (pin->id == PINID_LCD_D08) {

                                printk(KERN_INFO "gpio_request(PINID_LCD_D08) result=%d\n", ret);

                        }

                }


472件の閲覧回数
emanuelec
Contributor III

Thanks,

I not sure what I made but now it runs without problems!

Only for a more complete description this is the code I used (in my own mx28evk_pins.c):

static struct pin_desc acq_version_pins[] = {

    {

     .name         = "V.0",

     .id         = PINID_LCD_D08,

     .fun       = PIN_GPIO,

     .voltage    = PAD_3_3V,

     .strength = PAD_8MA,

     .output     = 0,

    },

    {

     .name         = "V.1",

     .id         = PINID_LCD_D09,

     .fun       = PIN_GPIO,

     .voltage    = PAD_3_3V,

     .strength = PAD_8MA,

     .output     = 0,

    },

...and otyher pins description at the same manner

In function mx28evk_pins_init I call:

void __init mx28evk_pins_init(void) {

mx28evk_init_pin_group(mx28evk_fixed_pins,ARRAY_SIZE(mx28evk_fixed_pins));

...

mx28evk_init_pin_group(acq_version_pins,ARRAY_SIZE(acq_version_pins));

gpio_export(MXS_PIN_TO_GPIO(PINID_LCD_D08), false);   

gpio_export(MXS_PIN_TO_GPIO(PINID_LCD_D09), false);


Now I have all the gpioXXX exported in sysfs and all works fine!


Thanks.