Skip to content

Commit

Permalink
backlight: Pass device through notify callback in the pwm driver
Browse files Browse the repository at this point in the history
Add the device to the notify callback's arguments in the PWM backlight 
driver. This brings the notify callback into line with the other 
callbacks defined by this driver.

Signed-off-by: Ben Dooks <ben@simtec.co.uk>
Signed-off-by: Simtec Linux Team <linux@simtec.co.uk>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
  • Loading branch information
Ben Dooks authored and Richard Purdie committed Dec 17, 2009
1 parent 5b0582e commit cfc3899
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions drivers/video/backlight/pwm_bl.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@

struct pwm_bl_data {
struct pwm_device *pwm;
struct device *dev;
unsigned int period;
int (*notify)(int brightness);
int (*notify)(struct device *,
int brightness);
};

static int pwm_backlight_update_status(struct backlight_device *bl)
Expand All @@ -39,7 +41,7 @@ static int pwm_backlight_update_status(struct backlight_device *bl)
brightness = 0;

if (pb->notify)
brightness = pb->notify(brightness);
brightness = pb->notify(pb->dev, brightness);

if (brightness == 0) {
pwm_config(pb->pwm, 0, pb->period);
Expand Down Expand Up @@ -88,6 +90,7 @@ static int pwm_backlight_probe(struct platform_device *pdev)

pb->period = data->pwm_period_ns;
pb->notify = data->notify;
pb->dev = &pdev->dev;

pb->pwm = pwm_request(data->pwm_id, "backlight");
if (IS_ERR(pb->pwm)) {
Expand Down Expand Up @@ -146,7 +149,7 @@ static int pwm_backlight_suspend(struct platform_device *pdev,
struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev);

if (pb->notify)
pb->notify(0);
pb->notify(pb->dev, 0);
pwm_config(pb->pwm, 0, pb->period);
pwm_disable(pb->pwm);
return 0;
Expand Down
2 changes: 1 addition & 1 deletion include/linux/pwm_backlight.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ struct platform_pwm_backlight_data {
unsigned int dft_brightness;
unsigned int pwm_period_ns;
int (*init)(struct device *dev);
int (*notify)(int brightness);
int (*notify)(struct device *dev, int brightness);
void (*exit)(struct device *dev);
};

Expand Down

0 comments on commit cfc3899

Please sign in to comment.