This source file includes following definitions.
- do_gma_backlight_set
- gma_backlight_enable
- gma_backlight_disable
- gma_backlight_set
- gma_backlight_init
- gma_backlight_exit
1
2
3
4
5
6
7
8
9
10 #include "psb_drv.h"
11 #include "psb_intel_reg.h"
12 #include "psb_intel_drv.h"
13 #include "intel_bios.h"
14 #include "power.h"
15
16 #ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
17 static void do_gma_backlight_set(struct drm_device *dev)
18 {
19 struct drm_psb_private *dev_priv = dev->dev_private;
20 backlight_update_status(dev_priv->backlight_device);
21 }
22 #endif
23
24 void gma_backlight_enable(struct drm_device *dev)
25 {
26 #ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
27 struct drm_psb_private *dev_priv = dev->dev_private;
28 dev_priv->backlight_enabled = true;
29 if (dev_priv->backlight_device) {
30 dev_priv->backlight_device->props.brightness = dev_priv->backlight_level;
31 do_gma_backlight_set(dev);
32 }
33 #endif
34 }
35
36 void gma_backlight_disable(struct drm_device *dev)
37 {
38 #ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
39 struct drm_psb_private *dev_priv = dev->dev_private;
40 dev_priv->backlight_enabled = false;
41 if (dev_priv->backlight_device) {
42 dev_priv->backlight_device->props.brightness = 0;
43 do_gma_backlight_set(dev);
44 }
45 #endif
46 }
47
48 void gma_backlight_set(struct drm_device *dev, int v)
49 {
50 #ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
51 struct drm_psb_private *dev_priv = dev->dev_private;
52 dev_priv->backlight_level = v;
53 if (dev_priv->backlight_device && dev_priv->backlight_enabled) {
54 dev_priv->backlight_device->props.brightness = v;
55 do_gma_backlight_set(dev);
56 }
57 #endif
58 }
59
60 int gma_backlight_init(struct drm_device *dev)
61 {
62 #ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
63 struct drm_psb_private *dev_priv = dev->dev_private;
64 dev_priv->backlight_enabled = true;
65 return dev_priv->ops->backlight_init(dev);
66 #else
67 return 0;
68 #endif
69 }
70
71 void gma_backlight_exit(struct drm_device *dev)
72 {
73 #ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
74 struct drm_psb_private *dev_priv = dev->dev_private;
75 if (dev_priv->backlight_device) {
76 dev_priv->backlight_device->props.brightness = 0;
77 backlight_update_status(dev_priv->backlight_device);
78 backlight_device_unregister(dev_priv->backlight_device);
79 }
80 #endif
81 }