diff options
Diffstat (limited to 'drivers/video/backlight/atmel-pwm-bl.c')
-rw-r--r-- | drivers/video/backlight/atmel-pwm-bl.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/video/backlight/atmel-pwm-bl.c b/drivers/video/backlight/atmel-pwm-bl.c index 505c0823a105..e6a66dab088c 100644 --- a/drivers/video/backlight/atmel-pwm-bl.c +++ b/drivers/video/backlight/atmel-pwm-bl.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/backlight.h> | 17 | #include <linux/backlight.h> |
18 | #include <linux/atmel_pwm.h> | 18 | #include <linux/atmel_pwm.h> |
19 | #include <linux/atmel-pwm-bl.h> | 19 | #include <linux/atmel-pwm-bl.h> |
20 | #include <linux/slab.h> | ||
20 | 21 | ||
21 | struct atmel_pwm_bl { | 22 | struct atmel_pwm_bl { |
22 | const struct atmel_pwm_bl_platform_data *pdata; | 23 | const struct atmel_pwm_bl_platform_data *pdata; |
@@ -113,13 +114,14 @@ static int atmel_pwm_bl_init_pwm(struct atmel_pwm_bl *pwmbl) | |||
113 | return pwm_channel_enable(&pwmbl->pwmc); | 114 | return pwm_channel_enable(&pwmbl->pwmc); |
114 | } | 115 | } |
115 | 116 | ||
116 | static struct backlight_ops atmel_pwm_bl_ops = { | 117 | static const struct backlight_ops atmel_pwm_bl_ops = { |
117 | .get_brightness = atmel_pwm_bl_get_intensity, | 118 | .get_brightness = atmel_pwm_bl_get_intensity, |
118 | .update_status = atmel_pwm_bl_set_intensity, | 119 | .update_status = atmel_pwm_bl_set_intensity, |
119 | }; | 120 | }; |
120 | 121 | ||
121 | static int atmel_pwm_bl_probe(struct platform_device *pdev) | 122 | static int atmel_pwm_bl_probe(struct platform_device *pdev) |
122 | { | 123 | { |
124 | struct backlight_properties props; | ||
123 | const struct atmel_pwm_bl_platform_data *pdata; | 125 | const struct atmel_pwm_bl_platform_data *pdata; |
124 | struct backlight_device *bldev; | 126 | struct backlight_device *bldev; |
125 | struct atmel_pwm_bl *pwmbl; | 127 | struct atmel_pwm_bl *pwmbl; |
@@ -158,15 +160,17 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev) | |||
158 | goto err_free_pwm; | 160 | goto err_free_pwm; |
159 | } | 161 | } |
160 | 162 | ||
161 | /* Turn display off by defatult. */ | 163 | /* Turn display off by default. */ |
162 | retval = gpio_direction_output(pwmbl->gpio_on, | 164 | retval = gpio_direction_output(pwmbl->gpio_on, |
163 | 0 ^ pdata->on_active_low); | 165 | 0 ^ pdata->on_active_low); |
164 | if (retval) | 166 | if (retval) |
165 | goto err_free_gpio; | 167 | goto err_free_gpio; |
166 | } | 168 | } |
167 | 169 | ||
168 | bldev = backlight_device_register("atmel-pwm-bl", | 170 | memset(&props, 0, sizeof(struct backlight_properties)); |
169 | &pdev->dev, pwmbl, &atmel_pwm_bl_ops); | 171 | props.max_brightness = pdata->pwm_duty_max - pdata->pwm_duty_min; |
172 | bldev = backlight_device_register("atmel-pwm-bl", &pdev->dev, pwmbl, | ||
173 | &atmel_pwm_bl_ops, &props); | ||
170 | if (IS_ERR(bldev)) { | 174 | if (IS_ERR(bldev)) { |
171 | retval = PTR_ERR(bldev); | 175 | retval = PTR_ERR(bldev); |
172 | goto err_free_gpio; | 176 | goto err_free_gpio; |
@@ -178,7 +182,6 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev) | |||
178 | 182 | ||
179 | /* Power up the backlight by default at middle intesity. */ | 183 | /* Power up the backlight by default at middle intesity. */ |
180 | bldev->props.power = FB_BLANK_UNBLANK; | 184 | bldev->props.power = FB_BLANK_UNBLANK; |
181 | bldev->props.max_brightness = pdata->pwm_duty_max - pdata->pwm_duty_min; | ||
182 | bldev->props.brightness = bldev->props.max_brightness / 2; | 185 | bldev->props.brightness = bldev->props.max_brightness / 2; |
183 | 186 | ||
184 | retval = atmel_pwm_bl_init_pwm(pwmbl); | 187 | retval = atmel_pwm_bl_init_pwm(pwmbl); |