Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have an embedded Linux board I'm working on, with a button and a couple LEDs.

By default, I can control the LEDs via

/sys/class/leds/redled/brightness

However, I have no way to monitor the button. If I enable CONFIG_GPIO_SYSFS, I can't see the LEDs anymore - /sys/class/leds/ is empty. Additionally, the GPIOs that in theory should go to the LEDs don't do anything, so I can't even hack it.

Any thoughts on how I could get both of these working?

share|improve this question

1 Answer 1

Solution turned out to be simple enough. It turned out I was poking the wrong GPIO. The beginning offset was defined in:

$LINUX/arch/arm/mach-at91/include/mach/gpio.h

as:

#define PIN_BASE    NR_AIC_IRQS

NR_AIC_IRQS is defined in irqs.h in the same directory as:

#define NR_AIC_IRQS 32

The pins I was looking for were PB12 and PB13, which I found in gpio.h defined as:

#define AT91_PIN_PB12   (PIN_BASE + 0X20 + 12)
#define AT91_PIN_PB13   (PIN_BASE + 0X20 + 13)

So the pins I was looking for were 32 + 32 + 12 = 76 and 77.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.