diff options
author | Matt Wagner <mwagner@nvidia.com> | 2013-01-16 15:54:46 -0800 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2013-09-14 13:11:56 -0700 |
commit | 95730406a0e3bbd7f862718782924a3c367845a1 (patch) | |
tree | 43d59720ed043f34715dfb9c8d7112d233422323 /drivers/video/backlight | |
parent | 4fa4c7d1285a439437e97708f5aa36ade6bb5e4d (diff) |
video: backlight: pwm_bl: add pwm_gpio
Add parameter for pwm_gpio if the pwm pin is on a GPIO
Doing this will allow us to keep the backlight on during boot
Bug 1219004
Change-Id: Ic159933aaf4fdebbd8ea36e2960ff83dfb5fcab5
Signed-off-by: Matt Wagner <mwagner@nvidia.com>
Reviewed-on: http://git-master/r/191821
(cherry picked from commit ef2e28d75508211baa47e0fd49505818681f08e4)
Reviewed-on: http://git-master/r/201657
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Thomas Cherry <tcherry@nvidia.com>
Diffstat (limited to 'drivers/video/backlight')
-rw-r--r-- | drivers/video/backlight/pwm_bl.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index 1fea627394d7..f7be6f224d69 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -17,6 +17,7 @@ #include <linux/fb.h> #include <linux/backlight.h> #include <linux/err.h> +#include <linux/gpio.h> #include <linux/pwm.h> #include <linux/pwm_backlight.h> #include <linux/slab.h> @@ -27,6 +28,7 @@ struct pwm_bl_data { unsigned int period; unsigned int lth_brightness; unsigned int *levels; + unsigned int pwm_gpio; int (*notify)(struct device *, int brightness); void (*notify_after)(struct device *, @@ -205,6 +207,7 @@ static int pwm_backlight_probe(struct platform_device *pdev) pb->check_fb = data->check_fb; pb->exit = data->exit; pb->dev = &pdev->dev; + pb->pwm_gpio = data->pwm_gpio; pb->pwm = devm_pwm_get(&pdev->dev, NULL); if (IS_ERR(pb->pwm)) { @@ -234,6 +237,13 @@ static int pwm_backlight_probe(struct platform_device *pdev) memset(&props, 0, sizeof(struct backlight_properties)); props.type = BACKLIGHT_RAW; props.max_brightness = data->max_brightness; + + if (gpio_is_valid(pb->pwm_gpio)) { + ret = gpio_request(pb->pwm_gpio, "disp_bl"); + if (ret) + dev_err(&pdev->dev, "backlight gpio request failed\n"); + } + bl = backlight_device_register(dev_name(&pdev->dev), &pdev->dev, pb, &pwm_backlight_ops, &props); if (IS_ERR(bl)) { @@ -252,6 +262,9 @@ static int pwm_backlight_probe(struct platform_device *pdev) bl->props.brightness = data->dft_brightness; backlight_update_status(bl); + if (gpio_is_valid(pb->pwm_gpio)) + gpio_free(pb->pwm_gpio); + platform_set_drvdata(pdev, bl); return 0; |