drm: Stop accessing encoder->bridge directly
[linux/fpc-iii.git] / drivers / leds / leds-hp6xx.c
blob54af9e63c09cf9e988aef125ecd7e18d51979417
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * LED Triggers Core
4 * For the HP Jornada 620/660/680/690 handhelds
6 * Copyright 2008 Kristoffer Ericson <kristoffer.ericson@gmail.com>
7 * this driver is based on leds-spitz.c by Richard Purdie.
8 */
10 #include <linux/module.h>
11 #include <linux/kernel.h>
12 #include <linux/platform_device.h>
13 #include <linux/leds.h>
14 #include <asm/hd64461.h>
15 #include <mach/hp6xx.h>
17 static void hp6xxled_green_set(struct led_classdev *led_cdev,
18 enum led_brightness value)
20 u8 v8;
22 v8 = inb(PKDR);
23 if (value)
24 outb(v8 & (~PKDR_LED_GREEN), PKDR);
25 else
26 outb(v8 | PKDR_LED_GREEN, PKDR);
29 static void hp6xxled_red_set(struct led_classdev *led_cdev,
30 enum led_brightness value)
32 u16 v16;
34 v16 = inw(HD64461_GPBDR);
35 if (value)
36 outw(v16 & (~HD64461_GPBDR_LED_RED), HD64461_GPBDR);
37 else
38 outw(v16 | HD64461_GPBDR_LED_RED, HD64461_GPBDR);
41 static struct led_classdev hp6xx_red_led = {
42 .name = "hp6xx:red",
43 .default_trigger = "hp6xx-charge",
44 .brightness_set = hp6xxled_red_set,
45 .flags = LED_CORE_SUSPENDRESUME,
48 static struct led_classdev hp6xx_green_led = {
49 .name = "hp6xx:green",
50 .default_trigger = "disk-activity",
51 .brightness_set = hp6xxled_green_set,
52 .flags = LED_CORE_SUSPENDRESUME,
55 static int hp6xxled_probe(struct platform_device *pdev)
57 int ret;
59 ret = devm_led_classdev_register(&pdev->dev, &hp6xx_red_led);
60 if (ret < 0)
61 return ret;
63 return devm_led_classdev_register(&pdev->dev, &hp6xx_green_led);
66 static struct platform_driver hp6xxled_driver = {
67 .probe = hp6xxled_probe,
68 .driver = {
69 .name = "hp6xx-led",
73 module_platform_driver(hp6xxled_driver);
75 MODULE_AUTHOR("Kristoffer Ericson <kristoffer.ericson@gmail.com>");
76 MODULE_DESCRIPTION("HP Jornada 6xx LED driver");
77 MODULE_LICENSE("GPL");
78 MODULE_ALIAS("platform:hp6xx-led");