aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/nvidia
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@rpsys.net>2007-02-10 18:07:48 -0500
committerRichard Purdie <rpurdie@rpsys.net>2007-02-20 04:26:53 -0500
commit599a52d12629394236d785615808845823875868 (patch)
tree4e2dfa3a25ce761be0ecc0490acabac553f77a67 /drivers/video/nvidia
parent321709c5994f952b78d567fd7083dbebbdc381b7 (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/video/nvidia')
-rw-r--r--drivers/video/nvidia/nv_backlight.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/video/nvidia/nv_backlight.c b/drivers/video/nvidia/nv_backlight.c
index 0e2bc519dcab..b7016e9b9e13 100644
--- a/drivers/video/nvidia/nv_backlight.c
+++ b/drivers/video/nvidia/nv_backlight.c
@@ -54,11 +54,11 @@ static int nvidia_bl_update_status(struct backlight_device *bd)
54 if (!par->FlatPanel) 54 if (!par->FlatPanel)
55 return 0; 55 return 0;
56 56
57 if (bd->props->power != FB_BLANK_UNBLANK || 57 if (bd->props.power != FB_BLANK_UNBLANK ||
58 bd->props->fb_blank != FB_BLANK_UNBLANK) 58 bd->props.fb_blank != FB_BLANK_UNBLANK)
59 level = 0; 59 level = 0;
60 else 60 else
61 level = bd->props->brightness; 61 level = bd->props.brightness;
62 62
63 tmp_pmc = NV_RD32(par->PMC, 0x10F0) & 0x0000FFFF; 63 tmp_pmc = NV_RD32(par->PMC, 0x10F0) & 0x0000FFFF;
64 tmp_pcrt = NV_RD32(par->PCRTC0, 0x081C) & 0xFFFFFFFC; 64 tmp_pcrt = NV_RD32(par->PCRTC0, 0x081C) & 0xFFFFFFFC;
@@ -81,13 +81,12 @@ static int nvidia_bl_update_status(struct backlight_device *bd)
81 81
82static int nvidia_bl_get_brightness(struct backlight_device *bd) 82static int nvidia_bl_get_brightness(struct backlight_device *bd)
83{ 83{
84 return bd->props->brightness; 84 return bd->props.brightness;
85} 85}
86 86
87static struct backlight_properties nvidia_bl_data = { 87static struct backlight_ops nvidia_bl_ops = {
88 .get_brightness = nvidia_bl_get_brightness, 88 .get_brightness = nvidia_bl_get_brightness,
89 .update_status = nvidia_bl_update_status, 89 .update_status = nvidia_bl_update_status,
90 .max_brightness = (FB_BACKLIGHT_LEVELS - 1),
91}; 90};
92 91
93void nvidia_bl_init(struct nvidia_par *par) 92void nvidia_bl_init(struct nvidia_par *par)
@@ -107,7 +106,7 @@ void nvidia_bl_init(struct nvidia_par *par)
107 106
108 snprintf(name, sizeof(name), "nvidiabl%d", info->node); 107 snprintf(name, sizeof(name), "nvidiabl%d", info->node);
109 108
110 bd = backlight_device_register(name, info->dev, par, &nvidia_bl_data); 109 bd = backlight_device_register(name, info->dev, par, &nvidia_bl_ops);
111 if (IS_ERR(bd)) { 110 if (IS_ERR(bd)) {
112 info->bl_dev = NULL; 111 info->bl_dev = NULL;
113 printk(KERN_WARNING "nvidia: Backlight registration failed\n"); 112 printk(KERN_WARNING "nvidia: Backlight registration failed\n");
@@ -119,8 +118,9 @@ void nvidia_bl_init(struct nvidia_par *par)
119 0x158 * FB_BACKLIGHT_MAX / MAX_LEVEL, 118 0x158 * FB_BACKLIGHT_MAX / MAX_LEVEL,
120 0x534 * FB_BACKLIGHT_MAX / MAX_LEVEL); 119 0x534 * FB_BACKLIGHT_MAX / MAX_LEVEL);
121 120
122 bd->props->brightness = nvidia_bl_data.max_brightness; 121 bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
123 bd->props->power = FB_BLANK_UNBLANK; 122 bd->props.brightness = nvidia_bl_data.max_brightness;
123 bd->props.power = FB_BLANK_UNBLANK;
124 backlight_update_status(bd); 124 backlight_update_status(bd);
125 125
126 printk("nvidia: Backlight initialized (%s)\n", name); 126 printk("nvidia: Backlight initialized (%s)\n", name);