Commit dafbeadf authored by Bryan Wu's avatar Bryan Wu
Browse files

ARM: mach-omap1: retire custom LED code

parent 4ad54190
Loading
Loading
Loading
Loading
+0 −8
Original line number Original line Diff line number Diff line
@@ -61,14 +61,6 @@ obj-$(CONFIG_ARCH_OMAP850) += gpio7xx.o
obj-$(CONFIG_ARCH_OMAP15XX)		+= gpio15xx.o
obj-$(CONFIG_ARCH_OMAP15XX)		+= gpio15xx.o
obj-$(CONFIG_ARCH_OMAP16XX)		+= gpio16xx.o
obj-$(CONFIG_ARCH_OMAP16XX)		+= gpio16xx.o


# LEDs support
led-$(CONFIG_MACH_OMAP_H2)		+= leds-h2p2-debug.o
led-$(CONFIG_MACH_OMAP_H3)		+= leds-h2p2-debug.o
led-$(CONFIG_MACH_OMAP_INNOVATOR)	+= leds-innovator.o
led-$(CONFIG_MACH_OMAP_PERSEUS2)	+= leds-h2p2-debug.o
led-$(CONFIG_MACH_OMAP_OSK)		+= leds-osk.o
obj-$(CONFIG_LEDS)			+= $(led-y)

ifneq ($(CONFIG_FB_OMAP),)
ifneq ($(CONFIG_FB_OMAP),)
obj-y += lcd_dma.o
obj-y += lcd_dma.o
endif
endif
+32 −0
Original line number Original line Diff line number Diff line
@@ -31,6 +31,7 @@
#include <linux/i2c/tps65010.h>
#include <linux/i2c/tps65010.h>
#include <linux/smc91x.h>
#include <linux/smc91x.h>
#include <linux/omapfb.h>
#include <linux/omapfb.h>
#include <linux/leds.h>


#include <asm/mach-types.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/mach/arch.h>
@@ -306,12 +307,39 @@ static struct platform_device h2_irda_device = {
	.resource	= h2_irda_resources,
	.resource	= h2_irda_resources,
};
};


static struct gpio_led h2_gpio_led_pins[] = {
	{
		.name		= "h2:red",
		.default_trigger = "heartbeat",
		.gpio		= 3,
	},
	{
		.name		= "h2:green",
		.default_trigger = "cpu0",
		.gpio		= OMAP_MPUIO(4),
	},
};

static struct gpio_led_platform_data h2_gpio_led_data = {
	.leds		= h2_gpio_led_pins,
	.num_leds	= ARRAY_SIZE(h2_gpio_led_pins),
};

static struct platform_device h2_gpio_leds = {
	.name	= "leds-gpio",
	.id	= -1,
	.dev	= {
		.platform_data = &h2_gpio_led_data,
	},
};

static struct platform_device *h2_devices[] __initdata = {
static struct platform_device *h2_devices[] __initdata = {
	&h2_nor_device,
	&h2_nor_device,
	&h2_nand_device,
	&h2_nand_device,
	&h2_smc91x_device,
	&h2_smc91x_device,
	&h2_irda_device,
	&h2_irda_device,
	&h2_kp_device,
	&h2_kp_device,
	&h2_gpio_leds,
};
};


static void __init h2_init_smc91x(void)
static void __init h2_init_smc91x(void)
@@ -406,6 +434,10 @@ static void __init h2_init(void)
	omap_cfg_reg(E19_1610_KBR4);
	omap_cfg_reg(E19_1610_KBR4);
	omap_cfg_reg(N19_1610_KBR5);
	omap_cfg_reg(N19_1610_KBR5);


	/* GPIO based LEDs */
	omap_cfg_reg(P18_1610_GPIO3);
	omap_cfg_reg(MPUIO4);

	h2_smc91x_resources[1].start = gpio_to_irq(0);
	h2_smc91x_resources[1].start = gpio_to_irq(0);
	h2_smc91x_resources[1].end = gpio_to_irq(0);
	h2_smc91x_resources[1].end = gpio_to_irq(0);
	platform_add_devices(h2_devices, ARRAY_SIZE(h2_devices));
	platform_add_devices(h2_devices, ARRAY_SIZE(h2_devices));
+32 −0
Original line number Original line Diff line number Diff line
@@ -31,6 +31,7 @@
#include <linux/i2c/tps65010.h>
#include <linux/i2c/tps65010.h>
#include <linux/smc91x.h>
#include <linux/smc91x.h>
#include <linux/omapfb.h>
#include <linux/omapfb.h>
#include <linux/leds.h>


#include <asm/setup.h>
#include <asm/setup.h>
#include <asm/page.h>
#include <asm/page.h>
@@ -324,6 +325,32 @@ static struct spi_board_info h3_spi_board_info[] __initdata = {
	},
	},
};
};


static struct gpio_led h3_gpio_led_pins[] = {
	{
		.name		= "h3:red",
		.default_trigger = "heartbeat",
		.gpio		= 3,
	},
	{
		.name		= "h3:green",
		.default_trigger = "cpu0",
		.gpio		= OMAP_MPUIO(4),
	},
};

static struct gpio_led_platform_data h3_gpio_led_data = {
	.leds		= h3_gpio_led_pins,
	.num_leds	= ARRAY_SIZE(h3_gpio_led_pins),
};

static struct platform_device h3_gpio_leds = {
	.name	= "leds-gpio",
	.id	= -1,
	.dev	= {
		.platform_data = &h3_gpio_led_data,
	},
};

static struct platform_device *devices[] __initdata = {
static struct platform_device *devices[] __initdata = {
	&nor_device,
	&nor_device,
	&nand_device,
	&nand_device,
@@ -331,6 +358,7 @@ static struct platform_device *devices[] __initdata = {
	&intlat_device,
	&intlat_device,
	&h3_kp_device,
	&h3_kp_device,
	&h3_lcd_device,
	&h3_lcd_device,
	&h3_gpio_leds,
};
};


static struct omap_usb_config h3_usb_config __initdata = {
static struct omap_usb_config h3_usb_config __initdata = {
@@ -398,6 +426,10 @@ static void __init h3_init(void)
	omap_cfg_reg(E19_1610_KBR4);
	omap_cfg_reg(E19_1610_KBR4);
	omap_cfg_reg(N19_1610_KBR5);
	omap_cfg_reg(N19_1610_KBR5);


	/* GPIO based LEDs */
	omap_cfg_reg(P18_1610_GPIO3);
	omap_cfg_reg(MPUIO4);

	smc91x_resources[1].start = gpio_to_irq(40);
	smc91x_resources[1].start = gpio_to_irq(40);
	smc91x_resources[1].end = gpio_to_irq(40);
	smc91x_resources[1].end = gpio_to_irq(40);
	platform_add_devices(devices, ARRAY_SIZE(devices));
	platform_add_devices(devices, ARRAY_SIZE(devices));
+33 −0
Original line number Original line Diff line number Diff line
@@ -380,10 +380,37 @@ static struct platform_device osk5912_lcd_device = {
	.id		= -1,
	.id		= -1,
};
};


static struct gpio_led mistral_gpio_led_pins[] = {
	{
		.name		= "mistral:red",
		.default_trigger = "heartbeat",
		.gpio		= 3,
	},
	{
		.name		= "mistral:green",
		.default_trigger = "cpu0",
		.gpio		= OMAP_MPUIO(4),
	},
};

static struct gpio_led_platform_data mistral_gpio_led_data = {
	.leds		= mistral_gpio_led_pins,
	.num_leds	= ARRAY_SIZE(mistral_gpio_led_pins),
};

static struct platform_device mistral_gpio_leds = {
	.name	= "leds-gpio",
	.id	= -1,
	.dev	= {
		.platform_data = &mistral_gpio_led_data,
	},
};

static struct platform_device *mistral_devices[] __initdata = {
static struct platform_device *mistral_devices[] __initdata = {
	&osk5912_kp_device,
	&osk5912_kp_device,
	&mistral_bl_device,
	&mistral_bl_device,
	&osk5912_lcd_device,
	&osk5912_lcd_device,
	&mistral_gpio_leds,
};
};


static int mistral_get_pendown_state(void)
static int mistral_get_pendown_state(void)
@@ -508,6 +535,12 @@ static void __init osk_mistral_init(void)
	if (gpio_request(2, "lcd_pwr") == 0)
	if (gpio_request(2, "lcd_pwr") == 0)
		gpio_direction_output(2, 1);
		gpio_direction_output(2, 1);


	/*
	 * GPIO based LEDs
	 */
	omap_cfg_reg(P18_1610_GPIO3);
	omap_cfg_reg(MPUIO4);

	i2c_register_board_info(1, mistral_i2c_board_info,
	i2c_register_board_info(1, mistral_i2c_board_info,
			ARRAY_SIZE(mistral_i2c_board_info));
			ARRAY_SIZE(mistral_i2c_board_info));


+0 −166
Original line number Original line Diff line number Diff line
/*
 * linux/arch/arm/mach-omap1/leds-h2p2-debug.c
 *
 * Copyright 2003 by Texas Instruments Incorporated
 *
 * There are 16 LEDs on the debug board (all green); four may be used
 * for logical 'green', 'amber', 'red', and 'blue' (after "claiming").
 *
 * The "surfer" expansion board and H2 sample board also have two-color
 * green+red LEDs (in parallel), used here for timer and idle indicators.
 */
#include <linux/gpio.h>
#include <linux/init.h>
#include <linux/kernel_stat.h>
#include <linux/sched.h>
#include <linux/io.h>

#include <mach/hardware.h>
#include <asm/leds.h>
#include <asm/mach-types.h>

#include <plat/fpga.h>

#include "leds.h"


#define GPIO_LED_RED		3
#define GPIO_LED_GREEN		OMAP_MPUIO(4)


#define LED_STATE_ENABLED	0x01
#define LED_STATE_CLAIMED	0x02
#define LED_TIMER_ON		0x04

#define GPIO_IDLE		GPIO_LED_GREEN
#define GPIO_TIMER		GPIO_LED_RED


void h2p2_dbg_leds_event(led_event_t evt)
{
	unsigned long flags;

	static struct h2p2_dbg_fpga __iomem *fpga;
	static u16 led_state, hw_led_state;

	local_irq_save(flags);

	if (!(led_state & LED_STATE_ENABLED) && evt != led_start)
		goto done;

	switch (evt) {
	case led_start:
		if (!fpga)
			fpga = ioremap(H2P2_DBG_FPGA_START,
						H2P2_DBG_FPGA_SIZE);
		if (fpga) {
			led_state |= LED_STATE_ENABLED;
			__raw_writew(~0, &fpga->leds);
		}
		break;

	case led_stop:
	case led_halted:
		/* all leds off during suspend or shutdown */

		if (! machine_is_omap_perseus2()) {
			gpio_set_value(GPIO_TIMER, 0);
			gpio_set_value(GPIO_IDLE, 0);
		}

		__raw_writew(~0, &fpga->leds);
		led_state &= ~LED_STATE_ENABLED;
		if (evt == led_halted) {
			iounmap(fpga);
			fpga = NULL;
		}

		goto done;

	case led_claim:
		led_state |= LED_STATE_CLAIMED;
		hw_led_state = 0;
		break;

	case led_release:
		led_state &= ~LED_STATE_CLAIMED;
		break;

#ifdef CONFIG_LEDS_TIMER
	case led_timer:
		led_state ^= LED_TIMER_ON;

		if (machine_is_omap_perseus2())
			hw_led_state ^= H2P2_DBG_FPGA_P2_LED_TIMER;
		else {
			gpio_set_value(GPIO_TIMER, led_state & LED_TIMER_ON);
			goto done;
		}

		break;
#endif

#ifdef CONFIG_LEDS_CPU
	case led_idle_start:
		if (machine_is_omap_perseus2())
			hw_led_state |= H2P2_DBG_FPGA_P2_LED_IDLE;
		else {
			gpio_set_value(GPIO_IDLE, 1);
			goto done;
		}

		break;

	case led_idle_end:
		if (machine_is_omap_perseus2())
			hw_led_state &= ~H2P2_DBG_FPGA_P2_LED_IDLE;
		else {
			gpio_set_value(GPIO_IDLE, 0);
			goto done;
		}

		break;
#endif

	case led_green_on:
		hw_led_state |= H2P2_DBG_FPGA_LED_GREEN;
		break;
	case led_green_off:
		hw_led_state &= ~H2P2_DBG_FPGA_LED_GREEN;
		break;

	case led_amber_on:
		hw_led_state |= H2P2_DBG_FPGA_LED_AMBER;
		break;
	case led_amber_off:
		hw_led_state &= ~H2P2_DBG_FPGA_LED_AMBER;
		break;

	case led_red_on:
		hw_led_state |= H2P2_DBG_FPGA_LED_RED;
		break;
	case led_red_off:
		hw_led_state &= ~H2P2_DBG_FPGA_LED_RED;
		break;

	case led_blue_on:
		hw_led_state |= H2P2_DBG_FPGA_LED_BLUE;
		break;
	case led_blue_off:
		hw_led_state &= ~H2P2_DBG_FPGA_LED_BLUE;
		break;

	default:
		break;
	}


	/*
	 *  Actually burn the LEDs
	 */
	if (led_state & LED_STATE_ENABLED)
		__raw_writew(~hw_led_state, &fpga->leds);

done:
	local_irq_restore(flags);
}
Loading