Permalink
Browse files

Merge branch 'master' of github.com:buglabs/bug20-2.6.31-omap

  • Loading branch information...
2 parents 830910a + 95963da commit bade24e426ada53ce911185118b5bf412edd0e1b Matt Isaacs committed Feb 8, 2011
View
32 Documentation/bmi/bmi_overview.txt
@@ -0,0 +1,32 @@
+INTRODUCTION
+
+ BMI is the Bug Module Interface. This is a hardware standard for low
+ power plug and play devices. It's a bit like USB, but with lower power
+ requirements for mobile/embedded/battery-powered Devices.
+
+
+DESIGN OVERVIEW
+
+ BMI is composed of slots and PIMs (Plug In Modules). Slots are the
+ abstraction for the physical slots on a machine (bug board for this
+ version) PIM's Slot drivers are platform specific, and some devices
+ are slot limited such that a high baud video device may have only a
+ few select slots that it will work in.
+
+ PIM's are intended to work on any platform supporting the BMI,
+ regardless of the underlying platform, as long as the slot provides
+ the required features of the PIM.
+
+ As a bare minimum a BMI slot needs to provide and I2C connection, as
+ well as 2 IRQ pins to register the insertion and removal of modules.
+
+BMI BOOT PROCESS
+ The core BMI module is loaded as a bus driver as compiled-in kernel
+ module (see drivers/bmi/core/ ) During boot BMI is loaded and runs,
+ and slots are regiestered as bus items. Then modules are detected and
+ loaded individually depending on what module info was detected.
+
+ Modules can alternately be loaded at run-time when they are detected by
+ a change on a slots IRQ.
+
+
View
4 arch/arm/configs/omap3_bug_defconfig
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.31-omap1
-# Thu Dec 30 14:30:58 2010
+# Fri Jan 28 14:51:18 2011
#
CONFIG_ARM=y
CONFIG_HAVE_PWM=y
@@ -760,7 +760,6 @@ CONFIG_MISC_DEVICES=y
# CONFIG_ENCLOSURE_SERVICES is not set
# CONFIG_ISL29003 is not set
CONFIG_BUG_DOCK=y
-CONFIG_BUG_BQSIG=y
# CONFIG_C2PORT is not set
#
@@ -1771,6 +1770,7 @@ CONFIG_LEDS_TRIGGER_HEARTBEAT=y
CONFIG_LEDS_TRIGGER_BREATHE=y
CONFIG_LEDS_TRIGGER_BACKLIGHT=m
# CONFIG_LEDS_TRIGGER_GPIO is not set
+CONFIG_LEDS_TRIGGER_BQSIG=y
CONFIG_LEDS_TRIGGER_DEFAULT_ON=m
#
View
4 arch/arm/mach-omap2/board-omap3bug.c
@@ -605,14 +605,14 @@ static void __init omap3_bug_init_irq(void)
static struct gpio_led gpio_leds[] = {
{
.name = "omap3bug:green:battery",
- .default_trigger = "none",
+ .default_trigger = "batt-normal",
.gpio = 53,
.active_low = true,
.default_state = LEDS_GPIO_DEFSTATE_OFF,
},
{
.name = "omap3bug:red:battery",
- .default_trigger = "none",
+ .default_trigger = "batt-low",
.gpio = 54,
.active_low = true,
.default_state = LEDS_GPIO_DEFSTATE_OFF,
View
8 drivers/leds/Kconfig
@@ -317,6 +317,14 @@ config LEDS_TRIGGER_GPIO
If unsure, say N.
+config LEDS_TRIGGER_BQSIG
+ tristate "Bug Low Battery Signal Handler"
+ depends on LEDS_TRIGGERS
+ depends on I2C
+ help
+ Say yes to enable omap3 bug to respond to low battery signals issued
+ by the bq27500 fuel gauge.
+
config LEDS_TRIGGER_DEFAULT_ON
tristate "LED Default ON Trigger"
depends on LEDS_TRIGGERS
View
1 drivers/leds/Makefile
@@ -42,3 +42,4 @@ obj-$(CONFIG_LEDS_TRIGGER_BREATHE) += ledtrig-breathe.o
obj-$(CONFIG_LEDS_TRIGGER_BACKLIGHT) += ledtrig-backlight.o
obj-$(CONFIG_LEDS_TRIGGER_GPIO) += ledtrig-gpio.o
obj-$(CONFIG_LEDS_TRIGGER_DEFAULT_ON) += ledtrig-default-on.o
+obj-$(CONFIG_LEDS_TRIGGER_BQSIG) += ledtrig-bqsig.o
View
67 drivers/misc/bug_bqsig.c → drivers/leds/ledtrig-bqsig.c
@@ -24,12 +24,16 @@
#include <linux/interrupt.h>
#include <mach/mux.h>
#include <linux/bmi.h>
+#include <linux/leds.h>
+#include "leds.h"
#define BATT_LOW_GPIO 64
struct bqsig_device {
struct platform_device *pdev;
struct work_struct irq_handler_work;
+ struct led_trigger *batt_low_trig;
+ struct led_trigger *batt_normal_trig;
};
static struct platform_device *bug_bqsig_dev;
@@ -46,16 +50,20 @@ static inline struct bqsig_device *irq_handler_work_to_bqsig_device(struct work_
static void irq_handler_work(struct work_struct *work)
{
bool value;
- //struct bqsig_device *bq_signal = irq_handler_work_to_bqsig_device(work);
+ struct bqsig_device *bqsig = container_of(work, struct bqsig_device, irq_handler_work);
value = gpio_get_value(BATT_LOW_GPIO);
//asserted
if (value) {
- printk(KERN_INFO "WARNING: Low Battery!\n");
+ led_trigger_event(bqsig->batt_normal_trig, LED_OFF);
+ led_trigger_event(bqsig->batt_low_trig, LED_FULL);
+ printk(KERN_INFO "WARNING: Low Battery!\n");
}
else {
- printk(KERN_INFO "WARNING: Battery Level Safe\n");
+ led_trigger_event(bqsig->batt_normal_trig, LED_FULL);
+ led_trigger_event(bqsig->batt_low_trig, LED_OFF);
+ printk(KERN_INFO "WARNING: Battery Level Safe\n");
}
}
@@ -70,6 +78,45 @@ static irqreturn_t bqsig_irq_handler(int irq, void *dev_id)
return IRQ_HANDLED;
}
+static void bqsig_low_trig_activate(struct led_classdev *led)
+{
+ bool value;
+
+ value = gpio_get_value(BATT_LOW_GPIO);
+
+ if (value)
+ led_set_brightness(led, LED_FULL);
+ else
+ led_set_brightness(led, LED_OFF);
+
+ return;
+}
+
+static void bqsig_low_trig_deactivate(struct led_classdev *led)
+{
+ led_set_brightness(led, LED_OFF);
+ return;
+}
+
+static void bqsig_normal_trig_activate(struct led_classdev *led)
+{
+ bool value;
+
+ value = gpio_get_value(BATT_LOW_GPIO);
+
+ if (value)
+ led_set_brightness(led, LED_OFF);
+ else
+ led_set_brightness(led, LED_FULL);
+ return;
+}
+
+static void bqsig_normal_trig_deactivate(struct led_classdev *led)
+{
+ led_set_brightness(led, LED_OFF);
+ return;
+}
+
/*
* probe/remove
*/
@@ -107,6 +154,18 @@ static int bug_bqsig_probe(struct platform_device *pdev)
return -EINVAL;
}
+ led_trigger_register_simple("batt-low", &bq_signal->batt_low_trig);
+ led_trigger_register_simple("batt-normal", &bq_signal->batt_normal_trig);
+
+ if (bq_signal->batt_low_trig && bq_signal->batt_normal_trig) {
+ bq_signal->batt_low_trig->activate = bqsig_low_trig_activate;
+ bq_signal->batt_low_trig->deactivate = bqsig_low_trig_deactivate;
+ bq_signal->batt_normal_trig->activate = bqsig_normal_trig_activate;
+ bq_signal->batt_normal_trig->deactivate = bqsig_normal_trig_deactivate;
+ }
+ else
+ printk(KERN_ERR "%s led triggers failed to register...\n", __FUNCTION__);
+
printk(KERN_INFO "bug_bqsig: bug_bqsig_probe...\n");
return 0;
}
@@ -160,7 +219,7 @@ static void __exit bug_bqsig_exit(void)
platform_device_unregister(bug_bqsig_dev);
}
-module_init(bug_bqsig_init);
+subsys_initcall(bug_bqsig_init);
module_exit(bug_bqsig_exit);
MODULE_AUTHOR("Dave R");
View
6 drivers/misc/Kconfig
@@ -254,12 +254,6 @@ config BUG_DOCK
Say yes to enable omap3 bug to shut down and start up it's USB hub
as it is needed by modules/dock. This should probably be built in.
-config BUG_BQSIG
- tristate "Bug Low Battery Signal Handler"
- depends on I2C
- help
- Say yes to enable omap3 bug to respond to low battery signals issued
- by the bq27500 fuel gauge.
source "drivers/misc/c2port/Kconfig"
source "drivers/misc/eeprom/Kconfig"
View
1 drivers/misc/Makefile
@@ -21,6 +21,5 @@ obj-$(CONFIG_HP_ILO) += hpilo.o
obj-$(CONFIG_ISL29003) += isl29003.o
obj-$(CONFIG_C2PORT) += c2port/
obj-$(CONFIG_BUG_DOCK) += bug_dock.o
-obj-$(CONFIG_BUG_BQSIG) += bug_bqsig.o
obj-y += eeprom/
obj-y += cb710/

0 comments on commit bade24e

Please sign in to comment.