-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Quoth Andrew: "Random fixes. And a simple new LED driver which I'm trying to sneak in while you're not looking." Sneaking successful. * akpm: score: fix off-by-one index into syscall table mm: fix rss count leakage during migration SHM_UNLOCK: fix Unevictable pages stranded after swap SHM_UNLOCK: fix long unpreemptible section kdump: define KEXEC_NOTE_BYTES arch specific for s390x mm/hugetlb.c: undo change to page mapcount in fault handler mm: memcg: update the correct soft limit tree during migration proc: clear_refs: do not clear reserved pages drivers/video/backlight/l4f00242t03.c: return proper error in l4f00242t03_probe if regulator_get() fails drivers/video/backlight/adp88x0_bl.c: fix bit testing logic kprobes: initialize before using a hlist ipc/mqueue: simplify reading msgqueue limit leds: add led driver for Bachmann's ot200 mm: __count_immobile_pages(): make sure the node is online mm: fix NULL ptr dereference in __count_immobile_pages mm: fix warnings regarding enum migrate_mode
- Loading branch information
Showing
24 changed files
with
388 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
/* | ||
* Bachmann ot200 leds driver. | ||
* | ||
* Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de> | ||
* Christian Gmeiner <christian.gmeiner@gmail.com> | ||
* | ||
* License: GPL as published by the FSF. | ||
*/ | ||
|
||
#include <linux/kernel.h> | ||
#include <linux/init.h> | ||
#include <linux/platform_device.h> | ||
#include <linux/slab.h> | ||
#include <linux/leds.h> | ||
#include <linux/io.h> | ||
#include <linux/module.h> | ||
|
||
|
||
struct ot200_led { | ||
struct led_classdev cdev; | ||
const char *name; | ||
unsigned long port; | ||
u8 mask; | ||
}; | ||
|
||
/* | ||
* The device has three leds on the back panel (led_err, led_init and led_run) | ||
* and can handle up to seven leds on the front panel. | ||
*/ | ||
|
||
static struct ot200_led leds[] = { | ||
{ | ||
.name = "led_run", | ||
.port = 0x5a, | ||
.mask = BIT(0), | ||
}, | ||
{ | ||
.name = "led_init", | ||
.port = 0x5a, | ||
.mask = BIT(1), | ||
}, | ||
{ | ||
.name = "led_err", | ||
.port = 0x5a, | ||
.mask = BIT(2), | ||
}, | ||
{ | ||
.name = "led_1", | ||
.port = 0x49, | ||
.mask = BIT(7), | ||
}, | ||
{ | ||
.name = "led_2", | ||
.port = 0x49, | ||
.mask = BIT(6), | ||
}, | ||
{ | ||
.name = "led_3", | ||
.port = 0x49, | ||
.mask = BIT(5), | ||
}, | ||
{ | ||
.name = "led_4", | ||
.port = 0x49, | ||
.mask = BIT(4), | ||
}, | ||
{ | ||
.name = "led_5", | ||
.port = 0x49, | ||
.mask = BIT(3), | ||
}, | ||
{ | ||
.name = "led_6", | ||
.port = 0x49, | ||
.mask = BIT(2), | ||
}, | ||
{ | ||
.name = "led_7", | ||
.port = 0x49, | ||
.mask = BIT(1), | ||
} | ||
}; | ||
|
||
static DEFINE_SPINLOCK(value_lock); | ||
|
||
/* | ||
* we need to store the current led states, as it is not | ||
* possible to read the current led state via inb(). | ||
*/ | ||
static u8 leds_back; | ||
static u8 leds_front; | ||
|
||
static void ot200_led_brightness_set(struct led_classdev *led_cdev, | ||
enum led_brightness value) | ||
{ | ||
struct ot200_led *led = container_of(led_cdev, struct ot200_led, cdev); | ||
u8 *val; | ||
unsigned long flags; | ||
|
||
spin_lock_irqsave(&value_lock, flags); | ||
|
||
if (led->port == 0x49) | ||
val = &leds_front; | ||
else if (led->port == 0x5a) | ||
val = &leds_back; | ||
else | ||
BUG(); | ||
|
||
if (value == LED_OFF) | ||
*val &= ~led->mask; | ||
else | ||
*val |= led->mask; | ||
|
||
outb(*val, led->port); | ||
spin_unlock_irqrestore(&value_lock, flags); | ||
} | ||
|
||
static int __devinit ot200_led_probe(struct platform_device *pdev) | ||
{ | ||
int i; | ||
int ret; | ||
|
||
for (i = 0; i < ARRAY_SIZE(leds); i++) { | ||
|
||
leds[i].cdev.name = leds[i].name; | ||
leds[i].cdev.brightness_set = ot200_led_brightness_set; | ||
|
||
ret = led_classdev_register(&pdev->dev, &leds[i].cdev); | ||
if (ret < 0) | ||
goto err; | ||
} | ||
|
||
leds_front = 0; /* turn off all front leds */ | ||
leds_back = BIT(1); /* turn on init led */ | ||
outb(leds_front, 0x49); | ||
outb(leds_back, 0x5a); | ||
|
||
return 0; | ||
|
||
err: | ||
for (i = i - 1; i >= 0; i--) | ||
led_classdev_unregister(&leds[i].cdev); | ||
|
||
return ret; | ||
} | ||
|
||
static int __devexit ot200_led_remove(struct platform_device *pdev) | ||
{ | ||
int i; | ||
|
||
for (i = 0; i < ARRAY_SIZE(leds); i++) | ||
led_classdev_unregister(&leds[i].cdev); | ||
|
||
return 0; | ||
} | ||
|
||
static struct platform_driver ot200_led_driver = { | ||
.probe = ot200_led_probe, | ||
.remove = __devexit_p(ot200_led_remove), | ||
.driver = { | ||
.name = "leds-ot200", | ||
.owner = THIS_MODULE, | ||
}, | ||
}; | ||
|
||
module_platform_driver(ot200_led_driver); | ||
|
||
MODULE_AUTHOR("Sebastian A. Siewior <bigeasy@linutronix.de>"); | ||
MODULE_DESCRIPTION("ot200 LED driver"); | ||
MODULE_LICENSE("GPL"); | ||
MODULE_ALIAS("platform:leds-ot200"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifndef MIGRATE_MODE_H_INCLUDED | ||
#define MIGRATE_MODE_H_INCLUDED | ||
/* | ||
* MIGRATE_ASYNC means never block | ||
* MIGRATE_SYNC_LIGHT in the current implementation means to allow blocking | ||
* on most operations but not ->writepage as the potential stall time | ||
* is too significant | ||
* MIGRATE_SYNC will block when migrating pages | ||
*/ | ||
enum migrate_mode { | ||
MIGRATE_ASYNC, | ||
MIGRATE_SYNC_LIGHT, | ||
MIGRATE_SYNC, | ||
}; | ||
|
||
#endif /* MIGRATE_MODE_H_INCLUDED */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.