diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2014-07-24 12:17:49 -0400 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2014-07-25 10:16:36 -0400 |
commit | 2188a988bb87db7e2934ed388994e6dd96de4242 (patch) | |
tree | 2ed3758fa63630ccd8791c6f9844266e42cdd6f7 | |
parent | ff9c5422d8ebae60bafedf8608ec54d4d87a6bc0 (diff) |
backlight: Add driver for iPAQ micro backlight
This adds a driver for the backlight controlled by the microcontroller
on the Compaq iPAQ series of handheld computers: h3100, h3600
and h3700.
Acked-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
-rw-r--r-- | drivers/video/backlight/Kconfig | 9 | ||||
-rw-r--r-- | drivers/video/backlight/Makefile | 1 | ||||
-rw-r--r-- | drivers/video/backlight/ipaq_micro_bl.c | 83 |
3 files changed, 93 insertions, 0 deletions
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig index 5d449059a556..cc153f55d9f9 100644 --- a/drivers/video/backlight/Kconfig +++ b/drivers/video/backlight/Kconfig | |||
@@ -207,6 +207,15 @@ config BACKLIGHT_GENERIC | |||
207 | known as the Corgi backlight driver. If you have a Sharp Zaurus | 207 | known as the Corgi backlight driver. If you have a Sharp Zaurus |
208 | SL-C7xx, SL-Cxx00 or SL-6000x say y. | 208 | SL-C7xx, SL-Cxx00 or SL-6000x say y. |
209 | 209 | ||
210 | config BACKLIGHT_IPAQ_MICRO | ||
211 | tristate "iPAQ microcontroller backlight driver" | ||
212 | depends on MFD_IPAQ_MICRO | ||
213 | default y | ||
214 | help | ||
215 | Say y to enable the backlight driver for Compaq iPAQ handheld | ||
216 | computers. Say yes if you have one of the h3100/h3600/h3700 | ||
217 | machines. | ||
218 | |||
210 | config BACKLIGHT_LM3533 | 219 | config BACKLIGHT_LM3533 |
211 | tristate "Backlight Driver for LM3533" | 220 | tristate "Backlight Driver for LM3533" |
212 | depends on BACKLIGHT_CLASS_DEVICE | 221 | depends on BACKLIGHT_CLASS_DEVICE |
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile index bb820024f346..a9ea34a39cad 100644 --- a/drivers/video/backlight/Makefile +++ b/drivers/video/backlight/Makefile | |||
@@ -36,6 +36,7 @@ obj-$(CONFIG_BACKLIGHT_GENERIC) += generic_bl.o | |||
36 | obj-$(CONFIG_BACKLIGHT_GPIO) += gpio_backlight.o | 36 | obj-$(CONFIG_BACKLIGHT_GPIO) += gpio_backlight.o |
37 | obj-$(CONFIG_BACKLIGHT_HP680) += hp680_bl.o | 37 | obj-$(CONFIG_BACKLIGHT_HP680) += hp680_bl.o |
38 | obj-$(CONFIG_BACKLIGHT_HP700) += jornada720_bl.o | 38 | obj-$(CONFIG_BACKLIGHT_HP700) += jornada720_bl.o |
39 | obj-$(CONFIG_BACKLIGHT_IPAQ_MICRO) += ipaq_micro_bl.o | ||
39 | obj-$(CONFIG_BACKLIGHT_LM3533) += lm3533_bl.o | 40 | obj-$(CONFIG_BACKLIGHT_LM3533) += lm3533_bl.o |
40 | obj-$(CONFIG_BACKLIGHT_LM3630A) += lm3630a_bl.o | 41 | obj-$(CONFIG_BACKLIGHT_LM3630A) += lm3630a_bl.o |
41 | obj-$(CONFIG_BACKLIGHT_LM3639) += lm3639_bl.o | 42 | obj-$(CONFIG_BACKLIGHT_LM3639) += lm3639_bl.o |
diff --git a/drivers/video/backlight/ipaq_micro_bl.c b/drivers/video/backlight/ipaq_micro_bl.c new file mode 100644 index 000000000000..feab29c6b255 --- /dev/null +++ b/drivers/video/backlight/ipaq_micro_bl.c | |||
@@ -0,0 +1,83 @@ | |||
1 | /* | ||
2 | * This program is free software; you can redistribute it and/or modify | ||
3 | * it under the terms of the GNU General Public License version 2 as | ||
4 | * published by the Free Software Foundation. | ||
5 | * | ||
6 | * iPAQ microcontroller backlight support | ||
7 | * Author : Linus Walleij <linus.walleij@linaro.org> | ||
8 | */ | ||
9 | |||
10 | #include <linux/backlight.h> | ||
11 | #include <linux/err.h> | ||
12 | #include <linux/fb.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/mfd/ipaq-micro.h> | ||
15 | #include <linux/module.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | |||
18 | static int micro_bl_update_status(struct backlight_device *bd) | ||
19 | { | ||
20 | struct ipaq_micro *micro = dev_get_drvdata(&bd->dev); | ||
21 | int intensity = bd->props.brightness; | ||
22 | struct ipaq_micro_msg msg = { | ||
23 | .id = MSG_BACKLIGHT, | ||
24 | .tx_len = 3, | ||
25 | }; | ||
26 | |||
27 | if (bd->props.power != FB_BLANK_UNBLANK) | ||
28 | intensity = 0; | ||
29 | if (bd->props.state & (BL_CORE_FBBLANK | BL_CORE_SUSPENDED)) | ||
30 | intensity = 0; | ||
31 | |||
32 | /* | ||
33 | * Message format: | ||
34 | * Byte 0: backlight instance (usually 1) | ||
35 | * Byte 1: on/off | ||
36 | * Byte 2: intensity, 0-255 | ||
37 | */ | ||
38 | msg.tx_data[0] = 0x01; | ||
39 | msg.tx_data[1] = intensity > 0 ? 1 : 0; | ||
40 | msg.tx_data[2] = intensity; | ||
41 | return ipaq_micro_tx_msg_sync(micro, &msg); | ||
42 | } | ||
43 | |||
44 | static const struct backlight_ops micro_bl_ops = { | ||
45 | .options = BL_CORE_SUSPENDRESUME, | ||
46 | .update_status = micro_bl_update_status, | ||
47 | }; | ||
48 | |||
49 | static struct backlight_properties micro_bl_props = { | ||
50 | .type = BACKLIGHT_RAW, | ||
51 | .max_brightness = 255, | ||
52 | .power = FB_BLANK_UNBLANK, | ||
53 | .brightness = 64, | ||
54 | }; | ||
55 | |||
56 | static int micro_backlight_probe(struct platform_device *pdev) | ||
57 | { | ||
58 | struct backlight_device *bd; | ||
59 | struct ipaq_micro *micro = dev_get_drvdata(pdev->dev.parent); | ||
60 | |||
61 | bd = devm_backlight_device_register(&pdev->dev, "ipaq-micro-backlight", | ||
62 | &pdev->dev, micro, µ_bl_ops, | ||
63 | µ_bl_props); | ||
64 | if (IS_ERR(bd)) | ||
65 | return PTR_ERR(bd); | ||
66 | |||
67 | platform_set_drvdata(pdev, bd); | ||
68 | backlight_update_status(bd); | ||
69 | |||
70 | return 0; | ||
71 | } | ||
72 | |||
73 | struct platform_driver micro_backlight_device_driver = { | ||
74 | .driver = { | ||
75 | .name = "ipaq-micro-backlight", | ||
76 | }, | ||
77 | .probe = micro_backlight_probe, | ||
78 | }; | ||
79 | module_platform_driver(micro_backlight_device_driver); | ||
80 | |||
81 | MODULE_LICENSE("GPL v2"); | ||
82 | MODULE_DESCRIPTION("driver for iPAQ Atmel micro backlight"); | ||
83 | MODULE_ALIAS("platform:ipaq-micro-backlight"); | ||