linux/arch/arm/mach-omap1/leds.c
David Brownell e918edf7c2 ARM: OMAP: switch to gpio_direction_output
More conversion to the standard GPIO interfaces:  stop using
omap_set_gpio_direction() entirely, and switch over to the
gpio_direction_output() call.

Note that because gpio_direction_output() includes the initial
value, this change isn't quite transparent.

 - For the call sites which defined an initial value either
   before or after setting the direction, that value was used.

   When that value was previously assigned afterwards, this
   could eliminate a brief output glitch ... and possibly
   change behavior.  In a few cases (LCDs) several values
   were assigned together ... those were re-arranged to match
   the explicit sequence provided.

 - Some call sites didn't define such a value; so I chose an
   initial "off/reset" value that seemed to default to "off".

In short, files touched by this patch might notice some small
changes in startup behavior (with trivial fixes).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Tony Lindgren <tony@atomide.com>
2008-12-10 17:35:26 -08:00

67 lines
1.4 KiB
C

/*
* linux/arch/arm/mach-omap1/leds.c
*
* OMAP LEDs dispatcher
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <asm/leds.h>
#include <asm/mach-types.h>
#include <mach/gpio.h>
#include <mach/mux.h>
#include "leds.h"
static int __init
omap_leds_init(void)
{
if (machine_is_omap_innovator())
leds_event = innovator_leds_event;
else if (machine_is_omap_h2()
|| machine_is_omap_h3()
|| machine_is_omap_perseus2())
leds_event = h2p2_dbg_leds_event;
else if (machine_is_omap_osk())
leds_event = osk_leds_event;
else
return -1;
if (machine_is_omap_h2()
|| machine_is_omap_h3()
#ifdef CONFIG_OMAP_OSK_MISTRAL
|| machine_is_omap_osk()
#endif
) {
/* LED1/LED2 pins can be used as GPIO (as done here), or by
* the LPG (works even in deep sleep!), to drive a bicolor
* LED on the H2 sample board, and another on the H2/P2
* "surfer" expansion board.
*
* The same pins drive a LED on the OSK Mistral board, but
* that's a different kind of LED (just one color at a time).
*/
omap_cfg_reg(P18_1610_GPIO3);
if (omap_request_gpio(3) == 0)
gpio_direction_output(3, 1);
else
printk(KERN_WARNING "LED: can't get GPIO3/red?\n");
omap_cfg_reg(MPUIO4);
if (omap_request_gpio(OMAP_MPUIO(4)) == 0)
gpio_direction_output(OMAP_MPUIO(4), 1);
else
printk(KERN_WARNING "LED: can't get MPUIO4/green?\n");
}
leds_event(led_start);
return 0;
}
__initcall(omap_leds_init);