From c6b3cd0903bb29bca54daa83c183d6f20ee6bc90 Mon Sep 17 00:00:00 2001 From: Matt Wagner Date: Fri, 22 Jul 2011 00:13:08 -0700 Subject: video: backlight: tegra: add callback to tegra_pwm_backlight tegra-pwm-backlight now has a notify function that enables the brightness to be passed back to the boardfile where it is modified. Bug 854820 Change-Id: I1425d801f77987485b58c3cbedae464b5db88444 Reviewed-on: http://git-master/r/42639 Reviewed-by: Varun Colbert Tested-by: Varun Colbert --- drivers/video/backlight/tegra_pwm_bl.c | 5 +++++ include/linux/tegra_pwm_bl.h | 1 + 2 files changed, 6 insertions(+) diff --git a/drivers/video/backlight/tegra_pwm_bl.c b/drivers/video/backlight/tegra_pwm_bl.c index 4331e8ef626a..93f4645128a0 100644 --- a/drivers/video/backlight/tegra_pwm_bl.c +++ b/drivers/video/backlight/tegra_pwm_bl.c @@ -25,6 +25,7 @@ struct tegra_pwm_bl_data { struct device *dev; int which_dc; + int (*notify)(struct device *, int brightness); struct tegra_dc_pwm_params params; }; @@ -41,6 +42,9 @@ static int tegra_pwm_backlight_update_status(struct backlight_device *bl) if (bl->props.fb_blank != FB_BLANK_UNBLANK) brightness = 0; + if (tbl->notify) + brightness = tbl->notify(tbl->dev, brightness); + if (brightness > max) dev_err(&bl->dev, "Invalid brightness value: %d max: %d\n", brightness, max); @@ -95,6 +99,7 @@ static int tegra_pwm_backlight_probe(struct platform_device *pdev) tbl->dev = &pdev->dev; tbl->which_dc = data->which_dc; + tbl->notify = data->notify; tbl->params.which_pwm = data->which_pwm; tbl->params.gpio_conf_to_sfio = data->gpio_conf_to_sfio; tbl->params.switch_to_sfio = data->switch_to_sfio; diff --git a/include/linux/tegra_pwm_bl.h b/include/linux/tegra_pwm_bl.h index ee924842bf84..68fecb522cfc 100644 --- a/include/linux/tegra_pwm_bl.h +++ b/include/linux/tegra_pwm_bl.h @@ -22,6 +22,7 @@ struct platform_tegra_pwm_backlight_data { unsigned int period; unsigned int clk_div; unsigned int clk_select; + int (*notify)(struct device *dev, int brightness); }; #endif /* TERGA_PWM_BL_H */ -- cgit v1.2.3