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/backlight/tosa_bl.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/backlight/tosa_bl.c')
-rw-r--r-- | drivers/video/backlight/tosa_bl.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/video/backlight/tosa_bl.c b/drivers/video/backlight/tosa_bl.c index e14ce4d469f5..f57bbf170049 100644 --- a/drivers/video/backlight/tosa_bl.c +++ b/drivers/video/backlight/tosa_bl.c | |||
@@ -80,6 +80,7 @@ static const struct backlight_ops bl_ops = { | |||
80 | static int __devinit tosa_bl_probe(struct i2c_client *client, | 80 | static int __devinit tosa_bl_probe(struct i2c_client *client, |
81 | const struct i2c_device_id *id) | 81 | const struct i2c_device_id *id) |
82 | { | 82 | { |
83 | struct backlight_properties props; | ||
83 | struct tosa_bl_data *data = kzalloc(sizeof(struct tosa_bl_data), GFP_KERNEL); | 84 | struct tosa_bl_data *data = kzalloc(sizeof(struct tosa_bl_data), GFP_KERNEL); |
84 | int ret = 0; | 85 | int ret = 0; |
85 | if (!data) | 86 | if (!data) |
@@ -99,15 +100,16 @@ static int __devinit tosa_bl_probe(struct i2c_client *client, | |||
99 | i2c_set_clientdata(client, data); | 100 | i2c_set_clientdata(client, data); |
100 | data->i2c = client; | 101 | data->i2c = client; |
101 | 102 | ||
102 | data->bl = backlight_device_register("tosa-bl", &client->dev, | 103 | memset(&props, 0, sizeof(struct backlight_properties)); |
103 | data, &bl_ops); | 104 | props.max_brightness = 512 - 1; |
105 | data->bl = backlight_device_register("tosa-bl", &client->dev, data, | ||
106 | &bl_ops, &props); | ||
104 | if (IS_ERR(data->bl)) { | 107 | if (IS_ERR(data->bl)) { |
105 | ret = PTR_ERR(data->bl); | 108 | ret = PTR_ERR(data->bl); |
106 | goto err_reg; | 109 | goto err_reg; |
107 | } | 110 | } |
108 | 111 | ||
109 | data->bl->props.brightness = 69; | 112 | data->bl->props.brightness = 69; |
110 | data->bl->props.max_brightness = 512 - 1; | ||
111 | data->bl->props.power = FB_BLANK_UNBLANK; | 113 | data->bl->props.power = FB_BLANK_UNBLANK; |
112 | 114 | ||
113 | backlight_update_status(data->bl); | 115 | backlight_update_status(data->bl); |