Blame view
drivers/leds/leds-hp6xx.c
1.8 KB
d2912cb15
|
1 |
// SPDX-License-Identifier: GPL-2.0-only |
d39a7a63e
|
2 3 4 5 6 7 |
/* * LED Triggers Core * For the HP Jornada 620/660/680/690 handhelds * * Copyright 2008 Kristoffer Ericson <kristoffer.ericson@gmail.com> * this driver is based on leds-spitz.c by Richard Purdie. |
d39a7a63e
|
8 |
*/ |
86383b557
|
9 |
#include <linux/module.h> |
d39a7a63e
|
10 |
#include <linux/kernel.h> |
d39a7a63e
|
11 12 13 |
#include <linux/platform_device.h> #include <linux/leds.h> #include <asm/hd64461.h> |
7639a4541
|
14 |
#include <mach/hp6xx.h> |
d39a7a63e
|
15 |
|
4d404fd5c
|
16 17 |
static void hp6xxled_green_set(struct led_classdev *led_cdev, enum led_brightness value) |
d39a7a63e
|
18 19 20 21 22 23 24 25 26 |
{ u8 v8; v8 = inb(PKDR); if (value) outb(v8 & (~PKDR_LED_GREEN), PKDR); else outb(v8 | PKDR_LED_GREEN, PKDR); } |
4d404fd5c
|
27 28 |
static void hp6xxled_red_set(struct led_classdev *led_cdev, enum led_brightness value) |
d39a7a63e
|
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
{ u16 v16; v16 = inw(HD64461_GPBDR); if (value) outw(v16 & (~HD64461_GPBDR_LED_RED), HD64461_GPBDR); else outw(v16 | HD64461_GPBDR_LED_RED, HD64461_GPBDR); } static struct led_classdev hp6xx_red_led = { .name = "hp6xx:red", .default_trigger = "hp6xx-charge", .brightness_set = hp6xxled_red_set, |
859cb7f2a
|
43 |
.flags = LED_CORE_SUSPENDRESUME, |
d39a7a63e
|
44 45 46 47 |
}; static struct led_classdev hp6xx_green_led = { .name = "hp6xx:green", |
eb25cb995
|
48 |
.default_trigger = "disk-activity", |
d39a7a63e
|
49 |
.brightness_set = hp6xxled_green_set, |
859cb7f2a
|
50 |
.flags = LED_CORE_SUSPENDRESUME, |
d39a7a63e
|
51 |
}; |
d39a7a63e
|
52 53 54 |
static int hp6xxled_probe(struct platform_device *pdev) { int ret; |
c0fc68ba9
|
55 |
ret = devm_led_classdev_register(&pdev->dev, &hp6xx_red_led); |
d39a7a63e
|
56 57 |
if (ret < 0) return ret; |
c0fc68ba9
|
58 |
return devm_led_classdev_register(&pdev->dev, &hp6xx_green_led); |
d39a7a63e
|
59 60 61 62 |
} static struct platform_driver hp6xxled_driver = { .probe = hp6xxled_probe, |
d39a7a63e
|
63 64 65 66 |
.driver = { .name = "hp6xx-led", }, }; |
892a8843f
|
67 |
module_platform_driver(hp6xxled_driver); |
d39a7a63e
|
68 69 70 71 |
MODULE_AUTHOR("Kristoffer Ericson <kristoffer.ericson@gmail.com>"); MODULE_DESCRIPTION("HP Jornada 6xx LED driver"); MODULE_LICENSE("GPL"); |
892a8843f
|
72 |
MODULE_ALIAS("platform:hp6xx-led"); |