diff options
author | Richard Purdie <rpurdie@rpsys.net> | 2007-02-10 18:07:48 -0500 |
---|---|---|
committer | Richard Purdie <rpurdie@rpsys.net> | 2007-02-20 04:26:53 -0500 |
commit | 599a52d12629394236d785615808845823875868 (patch) | |
tree | 4e2dfa3a25ce761be0ecc0490acabac553f77a67 /drivers/macintosh | |
parent | 321709c5994f952b78d567fd7083dbebbdc381b7 (diff) |
backlight: Separate backlight properties from backlight ops pointers
Per device data such as brightness belongs to the indivdual device
and should therefore be separate from the the backlight operation
function pointers. This patch splits the two types of data and
allows simplifcation of some code.
Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Diffstat (limited to 'drivers/macintosh')
-rw-r--r-- | drivers/macintosh/via-pmu-backlight.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/macintosh/via-pmu-backlight.c b/drivers/macintosh/via-pmu-backlight.c index 9f9d03127978..7e27071746e4 100644 --- a/drivers/macintosh/via-pmu-backlight.c +++ b/drivers/macintosh/via-pmu-backlight.c | |||
@@ -15,7 +15,7 @@ | |||
15 | 15 | ||
16 | #define MAX_PMU_LEVEL 0xFF | 16 | #define MAX_PMU_LEVEL 0xFF |
17 | 17 | ||
18 | static struct backlight_properties pmu_backlight_data; | 18 | static struct backlight_ops pmu_backlight_data; |
19 | static DEFINE_SPINLOCK(pmu_backlight_lock); | 19 | static DEFINE_SPINLOCK(pmu_backlight_lock); |
20 | static int sleeping; | 20 | static int sleeping; |
21 | static u8 bl_curve[FB_BACKLIGHT_LEVELS]; | 21 | static u8 bl_curve[FB_BACKLIGHT_LEVELS]; |
@@ -72,7 +72,7 @@ static int pmu_backlight_update_status(struct backlight_device *bd) | |||
72 | { | 72 | { |
73 | struct adb_request req; | 73 | struct adb_request req; |
74 | unsigned long flags; | 74 | unsigned long flags; |
75 | int level = bd->props->brightness; | 75 | int level = bd->props.brightness; |
76 | 76 | ||
77 | spin_lock_irqsave(&pmu_backlight_lock, flags); | 77 | spin_lock_irqsave(&pmu_backlight_lock, flags); |
78 | 78 | ||
@@ -80,8 +80,8 @@ static int pmu_backlight_update_status(struct backlight_device *bd) | |||
80 | if (sleeping) | 80 | if (sleeping) |
81 | goto out; | 81 | goto out; |
82 | 82 | ||
83 | if (bd->props->power != FB_BLANK_UNBLANK || | 83 | if (bd->props.power != FB_BLANK_UNBLANK || |
84 | bd->props->fb_blank != FB_BLANK_UNBLANK) | 84 | bd->props.fb_blank != FB_BLANK_UNBLANK) |
85 | level = 0; | 85 | level = 0; |
86 | 86 | ||
87 | if (level > 0) { | 87 | if (level > 0) { |
@@ -107,13 +107,13 @@ out: | |||
107 | 107 | ||
108 | static int pmu_backlight_get_brightness(struct backlight_device *bd) | 108 | static int pmu_backlight_get_brightness(struct backlight_device *bd) |
109 | { | 109 | { |
110 | return bd->props->brightness; | 110 | return bd->props.brightness; |
111 | } | 111 | } |
112 | 112 | ||
113 | static struct backlight_properties pmu_backlight_data = { | 113 | static struct backlight_ops pmu_backlight_data = { |
114 | .get_brightness = pmu_backlight_get_brightness, | 114 | .get_brightness = pmu_backlight_get_brightness, |
115 | .update_status = pmu_backlight_update_status, | 115 | .update_status = pmu_backlight_update_status, |
116 | .max_brightness = (FB_BACKLIGHT_LEVELS - 1), | 116 | |
117 | }; | 117 | }; |
118 | 118 | ||
119 | #ifdef CONFIG_PM | 119 | #ifdef CONFIG_PM |
@@ -151,9 +151,10 @@ void __init pmu_backlight_init() | |||
151 | printk("pmubl: Backlight registration failed\n"); | 151 | printk("pmubl: Backlight registration failed\n"); |
152 | goto error; | 152 | goto error; |
153 | } | 153 | } |
154 | bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1; | ||
154 | pmu_backlight_init_curve(0x7F, 0x46, 0x0E); | 155 | pmu_backlight_init_curve(0x7F, 0x46, 0x0E); |
155 | 156 | ||
156 | level = pmu_backlight_data.max_brightness; | 157 | level = bd->props.max_brightness; |
157 | 158 | ||
158 | if (autosave) { | 159 | if (autosave) { |
159 | /* read autosaved value if available */ | 160 | /* read autosaved value if available */ |
@@ -163,11 +164,11 @@ void __init pmu_backlight_init() | |||
163 | 164 | ||
164 | level = pmu_backlight_curve_lookup( | 165 | level = pmu_backlight_curve_lookup( |
165 | (req.reply[0] >> 4) * | 166 | (req.reply[0] >> 4) * |
166 | pmu_backlight_data.max_brightness / 15); | 167 | bd->props.max_brightness / 15); |
167 | } | 168 | } |
168 | 169 | ||
169 | bd->props->brightness = level; | 170 | bd->props.brightness = level; |
170 | bd->props->power = FB_BLANK_UNBLANK; | 171 | bd->props.power = FB_BLANK_UNBLANK; |
171 | backlight_update_status(bd); | 172 | backlight_update_status(bd); |
172 | 173 | ||
173 | printk("pmubl: Backlight initialized (%s)\n", name); | 174 | printk("pmubl: Backlight initialized (%s)\n", name); |