backlight.c (97eb3f24352ec6632c2127b35d8087d2a809a9b9) | backlight.c (bb7ca747f8d6243b3943c5b133048652020f4a50) |
---|---|
1/* 2 * Backlight Lowlevel Control Abstraction 3 * 4 * Copyright (C) 2003,2004 Hewlett-Packard Company 5 * 6 */ 7 8#include <linux/module.h> --- 5 unchanged lines hidden (view full) --- 14#include <linux/err.h> 15#include <linux/fb.h> 16#include <linux/slab.h> 17 18#ifdef CONFIG_PMAC_BACKLIGHT 19#include <asm/backlight.h> 20#endif 21 | 1/* 2 * Backlight Lowlevel Control Abstraction 3 * 4 * Copyright (C) 2003,2004 Hewlett-Packard Company 5 * 6 */ 7 8#include <linux/module.h> --- 5 unchanged lines hidden (view full) --- 14#include <linux/err.h> 15#include <linux/fb.h> 16#include <linux/slab.h> 17 18#ifdef CONFIG_PMAC_BACKLIGHT 19#include <asm/backlight.h> 20#endif 21 |
22static const char const *backlight_types[] = { 23 [BACKLIGHT_RAW] = "raw", 24 [BACKLIGHT_PLATFORM] = "platform", 25 [BACKLIGHT_FIRMWARE] = "firmware", 26}; 27 |
|
22#if defined(CONFIG_FB) || (defined(CONFIG_FB_MODULE) && \ 23 defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)) 24/* This callback gets called when something important happens inside a 25 * framebuffer driver. We're looking if that important event is blanking, 26 * and if it is, we're switching backlight power as well ... 27 */ 28static int fb_notifier_callback(struct notifier_block *self, 29 unsigned long event, void *data) --- 134 unchanged lines hidden (view full) --- 164 } 165 mutex_unlock(&bd->ops_lock); 166 167 backlight_generate_event(bd, BACKLIGHT_UPDATE_SYSFS); 168 169 return rc; 170} 171 | 28#if defined(CONFIG_FB) || (defined(CONFIG_FB_MODULE) && \ 29 defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)) 30/* This callback gets called when something important happens inside a 31 * framebuffer driver. We're looking if that important event is blanking, 32 * and if it is, we're switching backlight power as well ... 33 */ 34static int fb_notifier_callback(struct notifier_block *self, 35 unsigned long event, void *data) --- 134 unchanged lines hidden (view full) --- 170 } 171 mutex_unlock(&bd->ops_lock); 172 173 backlight_generate_event(bd, BACKLIGHT_UPDATE_SYSFS); 174 175 return rc; 176} 177 |
178static ssize_t backlight_show_type(struct device *dev, 179 struct device_attribute *attr, char *buf) 180{ 181 struct backlight_device *bd = to_backlight_device(dev); 182 183 return sprintf(buf, "%s\n", backlight_types[bd->props.type]); 184} 185 |
|
172static ssize_t backlight_show_max_brightness(struct device *dev, 173 struct device_attribute *attr, char *buf) 174{ 175 struct backlight_device *bd = to_backlight_device(dev); 176 177 return sprintf(buf, "%d\n", bd->props.max_brightness); 178} 179 --- 49 unchanged lines hidden (view full) --- 229 230static struct device_attribute bl_device_attributes[] = { 231 __ATTR(bl_power, 0644, backlight_show_power, backlight_store_power), 232 __ATTR(brightness, 0644, backlight_show_brightness, 233 backlight_store_brightness), 234 __ATTR(actual_brightness, 0444, backlight_show_actual_brightness, 235 NULL), 236 __ATTR(max_brightness, 0444, backlight_show_max_brightness, NULL), | 186static ssize_t backlight_show_max_brightness(struct device *dev, 187 struct device_attribute *attr, char *buf) 188{ 189 struct backlight_device *bd = to_backlight_device(dev); 190 191 return sprintf(buf, "%d\n", bd->props.max_brightness); 192} 193 --- 49 unchanged lines hidden (view full) --- 243 244static struct device_attribute bl_device_attributes[] = { 245 __ATTR(bl_power, 0644, backlight_show_power, backlight_store_power), 246 __ATTR(brightness, 0644, backlight_show_brightness, 247 backlight_store_brightness), 248 __ATTR(actual_brightness, 0444, backlight_show_actual_brightness, 249 NULL), 250 __ATTR(max_brightness, 0444, backlight_show_max_brightness, NULL), |
251 __ATTR(type, 0444, backlight_show_type, NULL), |
|
237 __ATTR_NULL, 238}; 239 240/** 241 * backlight_force_update - tell the backlight subsystem that hardware state 242 * has changed 243 * @bd: the backlight device to update 244 * --- 42 unchanged lines hidden (view full) --- 287 288 new_bd->dev.class = backlight_class; 289 new_bd->dev.parent = parent; 290 new_bd->dev.release = bl_device_release; 291 dev_set_name(&new_bd->dev, name); 292 dev_set_drvdata(&new_bd->dev, devdata); 293 294 /* Set default properties */ | 252 __ATTR_NULL, 253}; 254 255/** 256 * backlight_force_update - tell the backlight subsystem that hardware state 257 * has changed 258 * @bd: the backlight device to update 259 * --- 42 unchanged lines hidden (view full) --- 302 303 new_bd->dev.class = backlight_class; 304 new_bd->dev.parent = parent; 305 new_bd->dev.release = bl_device_release; 306 dev_set_name(&new_bd->dev, name); 307 dev_set_drvdata(&new_bd->dev, devdata); 308 309 /* Set default properties */ |
295 if (props) | 310 if (props) { |
296 memcpy(&new_bd->props, props, 297 sizeof(struct backlight_properties)); | 311 memcpy(&new_bd->props, props, 312 sizeof(struct backlight_properties)); |
313 if (props->type <= 0 || props->type >= BACKLIGHT_TYPE_MAX) { 314 WARN(1, "%s: invalid backlight type", name); 315 new_bd->props.type = BACKLIGHT_RAW; 316 } 317 } else { 318 new_bd->props.type = BACKLIGHT_RAW; 319 } |
|
298 299 rc = device_register(&new_bd->dev); 300 if (rc) { 301 kfree(new_bd); 302 return ERR_PTR(rc); 303 } 304 305 rc = backlight_register_fb(new_bd); --- 74 unchanged lines hidden --- | 320 321 rc = device_register(&new_bd->dev); 322 if (rc) { 323 kfree(new_bd); 324 return ERR_PTR(rc); 325 } 326 327 rc = backlight_register_fb(new_bd); --- 74 unchanged lines hidden --- |