I'm working with an ARM machine that has a buzzer attached to GPIO pin 102. The machine is running Linux 2.6, so we have a sysfs interface to the pins in /sys/class/gpio. When I first tried to get the buzzer to work, I tried something like the following:# cd /sys/class/gpio# echo 102 > export# cd gpio102# echo out > direction# echo 1 > valueTo my dismay, the machine didn't make any noise. However, checking the source code for the buzzer driver written for WinCE, I noticed that the GPIO multiplexer was supposed to be set in a certain mode. I'm not very good with stuff outside of software-land, so I'm still not exactly sure what this means. However, since I was given the source code for the version of U-Boot used to boot Linux on the machine, I was able to edit it to set the GPIO bank mode by adding this line of code to the board's header file (u-boot/board/somecompany/someboard/someboard.h):MUX_VAL(CP(CCDC_DATA3), (IDIS | PTD | DIS | M4));I re-compiled the bootloader, copied it over, rebooted the machine, and re-ran my above test, and it worked! I thought I had accomplished my task. However, I was informed that the way I did it may not have been safe, since the GPIO bank may be used for other drivers. When I mount debugfs and check /sys/kernel/debug/gpio, it does appear that other GPIO pins in the GPIO bank are being used for drivers.I then tried a different approach - since the beep is mostly important at boot, I decided to try adding some code to the bootloader to beep:MUX_VAL(CP(CCDC_DATA3), (IDIS | PTD | DIS | M4));if(!gpio_request(102, buzzer)){    gpio_direction_output(102, 1);    udelay (500000);    gpio_direction_output(102, 0);}MUX_VAL(CP(CCDC_DATA3), (IEN  | PTD | DIS | M0));This works since the bootloader is single-threaded, so it doesn't have to fight over the GPIO bank. The last line resets the GPIO bank mux mode to the way it is set earlier in the code.This does successfully beep during bootloader execution, and as far as I can tell it doesn't interfere with any drivers since the GPIO bank is restored to the required state. However, it's not as useful as I'd like, because the beep during the bootloader sequence doesn't necessarily indicate that the full boot was successful. Instead, it would be much nicer if I could access the buzzer from within Linux, to indicate a successful boot or other events. However, I'm not having any luck finding documentation on setting a GPIO bank mux mode in Linux. My question, therefore, is as follows:Is there a way to set a GPIO bank's mux mode from kernel-space?
Set GPIO Bank Mux Mode
linux;u boot;gpio