From patchwork Sat Mar 5 01:08:59 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Morell X-Patchwork-Id: 611101 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p251A0An030522 for ; Sat, 5 Mar 2011 01:10:01 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760475Ab1CEBJ1 (ORCPT ); Fri, 4 Mar 2011 20:09:27 -0500 Received: from hqemgate03.nvidia.com ([216.228.121.140]:9402 "EHLO hqemgate03.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758213Ab1CEBJZ (ORCPT ); Fri, 4 Mar 2011 20:09:25 -0500 Received: from hqnvupgp07.nvidia.com (Not Verified[216.228.121.13]) by hqemgate03.nvidia.com id ; Fri, 04 Mar 2011 17:16:44 -0800 Received: from hqnvemgw01.nvidia.com ([172.17.108.22]) by hqnvupgp07.nvidia.com (PGP Universal service); Fri, 04 Mar 2011 17:09:11 -0800 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Fri, 04 Mar 2011 17:09:11 -0800 Received: from morell.nvidia.com (Not Verified[172.16.172.225]) by hqnvemgw01.nvidia.com with MailMarshal (v6, 7, 2, 8378) id ; Fri, 04 Mar 2011 17:09:12 -0800 From: Robert Morell To: Richard Purdie , Arun Murthy , Andrew Morton , Linus Walleij Cc: linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, Robert Morell Subject: [PATCH] video: pwm_backlight: Add check_fb hook Date: Fri, 4 Mar 2011 17:08:59 -0800 Message-Id: <1299287339-11494-1-git-send-email-rmorell@nvidia.com> X-Mailer: git-send-email 1.7.3.4 X-NVConfidentiality: public Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sat, 05 Mar 2011 01:10:01 +0000 (UTC) diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index 21866ec..0f2c131 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -28,6 +28,7 @@ struct pwm_bl_data { unsigned int lth_brightness; int (*notify)(struct device *, int brightness); + int (*check_fb)(struct device *, struct fb_info *); }; static int pwm_backlight_update_status(struct backlight_device *bl) @@ -62,9 +63,18 @@ static int pwm_backlight_get_brightness(struct backlight_device *bl) return bl->props.brightness; } +static int pwm_backlight_check_fb(struct backlight_device *bl, + struct fb_info *info) +{ + struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev); + + return !pb->check_fb || pb->check_fb(pb->dev, info); +} + static const struct backlight_ops pwm_backlight_ops = { .update_status = pwm_backlight_update_status, .get_brightness = pwm_backlight_get_brightness, + .check_fb = pwm_backlight_check_fb, }; static int pwm_backlight_probe(struct platform_device *pdev) @@ -95,6 +105,7 @@ static int pwm_backlight_probe(struct platform_device *pdev) pb->period = data->pwm_period_ns; pb->notify = data->notify; + pb->check_fb = data->check_fb; pb->lth_brightness = data->lth_brightness * (data->pwm_period_ns / data->max_brightness); pb->dev = &pdev->dev; diff --git a/include/linux/pwm_backlight.h b/include/linux/pwm_backlight.h index e031e1a..5e3e25a 100644 --- a/include/linux/pwm_backlight.h +++ b/include/linux/pwm_backlight.h @@ -4,6 +4,8 @@ #ifndef __LINUX_PWM_BACKLIGHT_H #define __LINUX_PWM_BACKLIGHT_H +#include + struct platform_pwm_backlight_data { int pwm_id; unsigned int max_brightness; @@ -13,6 +15,7 @@ struct platform_pwm_backlight_data { int (*init)(struct device *dev); int (*notify)(struct device *dev, int brightness); void (*exit)(struct device *dev); + int (*check_fb)(struct device *dev, struct fb_info *info); }; #endif