mirror of
https://github.com/genesi/linux-legacy.git
synced 2026-10-14 17:19:12 +00:00
sb: add new LED framework, delete the old one
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# Automatically generated make config: don't edit
|
||||
# Linux kernel version: 2.6.31.14.17
|
||||
# Sat Feb 12 04:06:59 2011
|
||||
# Wed Feb 16 00:51:28 2011
|
||||
#
|
||||
CONFIG_ARM=y
|
||||
CONFIG_HAVE_PWM=y
|
||||
@@ -1403,7 +1403,6 @@ CONFIG_POWER_SUPPLY=y
|
||||
# CONFIG_BATTERY_BQ27x00 is not set
|
||||
# CONFIG_BATTERY_MAX17040 is not set
|
||||
CONFIG_BATTERY_SBS=y
|
||||
# CONFIG_BATTERY_EFIKASB is not set
|
||||
# CONFIG_HWMON is not set
|
||||
# CONFIG_THERMAL is not set
|
||||
# CONFIG_THERMAL_HWMON is not set
|
||||
@@ -2110,7 +2109,6 @@ CONFIG_LEDS_CLASS=y
|
||||
#
|
||||
# LED drivers
|
||||
#
|
||||
CONFIG_LEDS_EFIKASB=y
|
||||
# CONFIG_LEDS_PCA9532 is not set
|
||||
CONFIG_LEDS_GPIO=y
|
||||
CONFIG_LEDS_GPIO_PLATFORM=y
|
||||
@@ -2130,6 +2128,7 @@ CONFIG_LEDS_TRIGGER_IDE_DISK=y
|
||||
# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
|
||||
CONFIG_LEDS_TRIGGER_GPIO=y
|
||||
CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
|
||||
CONFIG_LEDS_TRIGGER_INPUT=y
|
||||
|
||||
#
|
||||
# iptables trigger is under Netfilter config (LED target)
|
||||
|
||||
@@ -25,4 +25,4 @@ obj-$(CONFIG_MACH_MX51_EFIKAMX) += mx51_efikamx.o mx51_efikamx_io.o mx51_efikamx
|
||||
obj-$(CONFIG_MACH_MX51_EFIKASB) += mx51_efikasb.o mx51_efikasb_gpio.o mx51_efikamx_cpu.o mx51_efikasb_pmic.o \
|
||||
mx51_efikasb_input.o mx51_efikasb_lid.o mx51_efikasb_powerkey.o \
|
||||
mx51_efikamx_audio.o mx51_efikamx_ata.o mx51_efikamx_mmc.o \
|
||||
mx51_efikamx_uart.o early_setup.o
|
||||
mx51_efikamx_uart.o mx51_efikasb_leds.o early_setup.o
|
||||
|
||||
@@ -75,7 +75,6 @@ static int lvds_en_dir = 0;
|
||||
extern int mxc_get_battery_insertion_status(void);
|
||||
extern int mxc_get_ac_adapter_insertion_status(void);
|
||||
extern int mxc_get_batt_low_status(void);
|
||||
/* extern void mxc_turn_on_batt_low_led(int); */
|
||||
|
||||
extern int mxc_get_memory_id(void);
|
||||
extern unsigned int mxc_get_pcb_id(void);
|
||||
@@ -167,7 +166,8 @@ static void __init mx51_efikasb_init_display(void)
|
||||
}
|
||||
|
||||
|
||||
static void mxc_power_on_lcd(int on) {
|
||||
static void mxc_power_on_lcd(int on)
|
||||
{
|
||||
if(on) {
|
||||
gpio_set_value(IOMUX_TO_GPIO(LCD_PWRON_PIN), 1); /* LCD Power On */
|
||||
} else {
|
||||
@@ -176,7 +176,6 @@ static void mxc_power_on_lcd(int on) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void mxc_lvds_enable(int on)
|
||||
{
|
||||
if(on == -1) {
|
||||
@@ -251,12 +250,6 @@ static struct mxc_lcd_platform_data lvds_data = {
|
||||
.lvds_enable = mxc_lvds_enable,
|
||||
};
|
||||
|
||||
static struct platform_device mxc_led_device = {
|
||||
.name = "efikasb_leds",
|
||||
.id = 1,
|
||||
};
|
||||
|
||||
|
||||
enum mxc_power_resource {
|
||||
MAINS_INSERTION_STATUS,
|
||||
BATTERY_INSERTION_STATUS,
|
||||
@@ -540,7 +533,7 @@ static void __init mx51_efikasb_board_init(void)
|
||||
|
||||
mx51_efikasb_init_display();
|
||||
|
||||
mxc_register_device(&mxc_led_device, NULL);
|
||||
mx51_efikasb_init_leds();
|
||||
|
||||
mx51_efikasb_init_mc13892();
|
||||
|
||||
|
||||
@@ -108,6 +108,7 @@ extern void __init mx51_efikamx_init_soc(void);
|
||||
extern void __init mx51_efikamx_init_mmc(void);
|
||||
extern void __init mx51_efikamx_init_audio(void);
|
||||
extern void __init mx51_efikamx_init_pata(void);
|
||||
extern void __init mx51_efikasb_init_leds(void);
|
||||
|
||||
extern int __init mx51_efikasb_init_mc13892(void);
|
||||
|
||||
|
||||
85
arch/arm/mach-mx5/mx51_efikasb_leds.c
Normal file
85
arch/arm/mach-mx5/mx51_efikasb_leds.c
Normal file
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright 2009 Pegatron Corporation. All Rights Reserved.
|
||||
* Copyright 2009-2010 Genesi USA, Inc. All Rights Reserved.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The code contained herein is licensed under the GNU General Public
|
||||
* License. You may obtain a copy of the GNU General Public License
|
||||
* Version 2 or later at the following locations:
|
||||
*
|
||||
* http://www.opensource.org/licenses/gpl-license.html
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
#include <linux/errno.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/leds.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/gpio_keys.h>
|
||||
#include <mach/hardware.h>
|
||||
#include <mach/gpio.h>
|
||||
#include <mach/common.h>
|
||||
|
||||
#include "devices.h"
|
||||
#include "mx51_pins.h"
|
||||
#include "iomux.h"
|
||||
|
||||
#include "mx51_efikamx.h"
|
||||
|
||||
#define EFIKASB_CAPSLOCK_LED MX51_PIN_EIM_CS0
|
||||
#define EFIKASB_ALARM_LED MX51_PIN_GPIO1_3
|
||||
|
||||
static struct mxc_iomux_pin_cfg __initdata mx51_efikasb_led_iomux_pins[] = {
|
||||
{ EFIKASB_CAPSLOCK_LED, IOMUX_CONFIG_GPIO, },
|
||||
{ EFIKASB_ALARM_LED, IOMUX_CONFIG_GPIO, },
|
||||
|
||||
};
|
||||
|
||||
static struct gpio_led mx51_efikasb_leds[] = {
|
||||
{
|
||||
.name = "led:capslock",
|
||||
.default_trigger = "capslock",
|
||||
.gpio = IOMUX_TO_GPIO(EFIKASB_CAPSLOCK_LED),
|
||||
},
|
||||
{
|
||||
.name = "led:alarm", /* remind me to update the installer script */
|
||||
.default_trigger = "ide-disk",
|
||||
.gpio = IOMUX_TO_GPIO(EFIKASB_ALARM_LED),
|
||||
},
|
||||
};
|
||||
|
||||
static struct gpio_led_platform_data mx51_efikasb_leds_data = {
|
||||
.leds = mx51_efikasb_leds,
|
||||
.num_leds = ARRAY_SIZE(mx51_efikasb_leds),
|
||||
};
|
||||
|
||||
static struct platform_device mx51_efikasb_leds_device = {
|
||||
.name = "leds-gpio",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &mx51_efikasb_leds_data,
|
||||
},
|
||||
};
|
||||
|
||||
void __init mx51_efikasb_init_leds(void)
|
||||
{
|
||||
CONFIG_IOMUX(mx51_efikasb_led_iomux_pins);
|
||||
|
||||
/*
|
||||
Request each color and set a default output.
|
||||
Since Green is our power light by default, turn it on.
|
||||
Since Red & Blue are disk activity, turn them off (the trigger will activate it)
|
||||
*/
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKASB_CAPSLOCK_LED), "led:capslock");
|
||||
gpio_direction_output(IOMUX_TO_GPIO(EFIKASB_CAPSLOCK_LED), 0);
|
||||
gpio_free(IOMUX_TO_GPIO(EFIKASB_CAPSLOCK_LED));
|
||||
|
||||
gpio_request(IOMUX_TO_GPIO(EFIKASB_ALARM_LED), "led:alarm");
|
||||
gpio_direction_output(IOMUX_TO_GPIO(EFIKASB_ALARM_LED), 1);
|
||||
gpio_free(IOMUX_TO_GPIO(EFIKASB_ALARM_LED));
|
||||
|
||||
(void)platform_device_register(&mx51_efikasb_leds_device);
|
||||
}
|
||||
Reference in New Issue
Block a user