summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Huang <kevinh@nvidia.com>2011-09-13 16:26:40 -0700
committerVarun Colbert <vcolbert@nvidia.com>2011-09-14 14:34:12 -0700
commit92ec78210ee1526dc2c35b7775674105aa6f729b (patch)
treefa3833984321afa75171ef95824a7c4c3aea1f97
parent5d171387f978f5b420b5ed8cfb6c60365f8bddc8 (diff)
video: backlight: tegra: Add check_fb hook.
Bug 873860 Change-Id: Ia29a74689c150fec782e91884bd4116bd89f253c Reviewed-on: http://git-master/r/52135 Reviewed-by: Kevin Huang (Eng-SW) <kevinh@nvidia.com> Tested-by: Kevin Huang (Eng-SW) <kevinh@nvidia.com> Reviewed-by: Robert Morell <rmorell@nvidia.com>
-rw-r--r--drivers/video/backlight/tegra_pwm_bl.c10
-rw-r--r--include/linux/tegra_pwm_bl.h3
2 files changed, 13 insertions, 0 deletions
diff --git a/drivers/video/backlight/tegra_pwm_bl.c b/drivers/video/backlight/tegra_pwm_bl.c
index 93f4645128a0..5bd2113a37a9 100644
--- a/drivers/video/backlight/tegra_pwm_bl.c
+++ b/drivers/video/backlight/tegra_pwm_bl.c
@@ -27,6 +27,7 @@ struct tegra_pwm_bl_data {
int which_dc;
int (*notify)(struct device *, int brightness);
struct tegra_dc_pwm_params params;
+ int (*check_fb)(struct device *dev, struct fb_info *info);
};
static int tegra_pwm_backlight_update_status(struct backlight_device *bl)
@@ -71,9 +72,17 @@ static int tegra_pwm_backlight_get_brightness(struct backlight_device *bl)
return bl->props.brightness;
}
+static int tegra_pwm_backlight_check_fb(struct backlight_device *bl,
+ struct fb_info *info)
+{
+ struct tegra_pwm_bl_data *tbl = dev_get_drvdata(&bl->dev);
+ return !tbl->check_fb || tbl->check_fb(tbl->dev, info);
+}
+
static const struct backlight_ops tegra_pwm_backlight_ops = {
.update_status = tegra_pwm_backlight_update_status,
.get_brightness = tegra_pwm_backlight_get_brightness,
+ .check_fb = tegra_pwm_backlight_check_fb,
};
static int tegra_pwm_backlight_probe(struct platform_device *pdev)
@@ -100,6 +109,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->check_fb = data->check_fb;
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 68fecb522cfc..71a81f2eda88 100644
--- a/include/linux/tegra_pwm_bl.h
+++ b/include/linux/tegra_pwm_bl.h
@@ -12,6 +12,8 @@
#ifndef TEGRA_PWM_BL_H
#define TEGRA_PWM_BL_H
+#include <linux/backlight.h>
+
struct platform_tegra_pwm_backlight_data {
int which_dc;
int which_pwm;
@@ -23,6 +25,7 @@ struct platform_tegra_pwm_backlight_data {
unsigned int clk_div;
unsigned int clk_select;
int (*notify)(struct device *dev, int brightness);
+ int (*check_fb)(struct device *dev, struct fb_info *info);
};
#endif /* TERGA_PWM_BL_H */