diff options
author | Matthew Garrett <mjg@redhat.com> | 2010-02-17 16:39:44 -0500 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-03-16 15:47:54 -0400 |
commit | a19a6ee6cad2b20292a774c2f56ba8039b0fac9c (patch) | |
tree | 631916ce6181336c5c28eb0cf5484c40c92986b6 /drivers/video/nvidia/nv_backlight.c | |
parent | 57e148b6a975980944f4466ccb669b1d02dfc6a1 (diff) |
backlight: Allow properties to be passed at registration
Values such as max_brightness should be set before backlights are
registered, but the current API doesn't allow that. Add a parameter to
backlight_device_register and update drivers to ensure that they
set this correctly.
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'drivers/video/nvidia/nv_backlight.c')
-rw-r--r-- | drivers/video/nvidia/nv_backlight.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/video/nvidia/nv_backlight.c b/drivers/video/nvidia/nv_backlight.c index 443e3c85a9a0..2fb552a6f32c 100644 --- a/drivers/video/nvidia/nv_backlight.c +++ b/drivers/video/nvidia/nv_backlight.c | |||
@@ -94,6 +94,7 @@ static struct backlight_ops nvidia_bl_ops = { | |||
94 | 94 | ||
95 | void nvidia_bl_init(struct nvidia_par *par) | 95 | void nvidia_bl_init(struct nvidia_par *par) |
96 | { | 96 | { |
97 | struct backlight_properties props; | ||
97 | struct fb_info *info = pci_get_drvdata(par->pci_dev); | 98 | struct fb_info *info = pci_get_drvdata(par->pci_dev); |
98 | struct backlight_device *bd; | 99 | struct backlight_device *bd; |
99 | char name[12]; | 100 | char name[12]; |
@@ -109,7 +110,10 @@ void nvidia_bl_init(struct nvidia_par *par) | |||
109 | 110 | ||
110 | snprintf(name, sizeof(name), "nvidiabl%d", info->node); | 111 | snprintf(name, sizeof(name), "nvidiabl%d", info->node); |
111 | 112 | ||
112 | bd = backlight_device_register(name, info->dev, par, &nvidia_bl_ops); | 113 | memset(&props, 0, sizeof(struct backlight_properties)); |
114 | props.max_brightness = FB_BACKLIGHT_LEVELS - 1; | ||
115 | bd = backlight_device_register(name, info->dev, par, &nvidia_bl_ops, | ||
116 | &props); | ||
113 | if (IS_ERR(bd)) { | 117 | if (IS_ERR(bd)) { |
114 | info->bl_dev = NULL; | 118 | info->bl_dev = NULL; |
115 | printk(KERN_WARNING "nvidia: Backlight registration failed\n"); | 119 | printk(KERN_WARNING "nvidia: Backlight registration failed\n"); |
@@ -121,7 +125,6 @@ void nvidia_bl_init(struct nvidia_par *par) | |||
121 | 0x158 * FB_BACKLIGHT_MAX / MAX_LEVEL, | 125 | 0x158 * FB_BACKLIGHT_MAX / MAX_LEVEL, |
122 | 0x534 * FB_BACKLIGHT_MAX / MAX_LEVEL); | 126 | 0x534 * FB_BACKLIGHT_MAX / MAX_LEVEL); |
123 | 127 | ||
124 | bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1; | ||
125 | bd->props.brightness = bd->props.max_brightness; | 128 | bd->props.brightness = bd->props.max_brightness; |
126 | bd->props.power = FB_BLANK_UNBLANK; | 129 | bd->props.power = FB_BLANK_UNBLANK; |
127 | backlight_update_status(bd); | 130 | backlight_update_status(bd); |