From patchwork Tue Aug 9 02:05:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: dilee@nvidia.com X-Patchwork-Id: 1047302 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p7925CB7029000 for ; Tue, 9 Aug 2011 02:06:48 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751328Ab1HICGs (ORCPT ); Mon, 8 Aug 2011 22:06:48 -0400 Received: from hqemgate04.nvidia.com ([216.228.121.35]:6106 "EHLO hqemgate04.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750953Ab1HICGr (ORCPT ); Mon, 8 Aug 2011 22:06:47 -0400 Received: from hqnvupgp07.nvidia.com (Not Verified[216.228.121.13]) by hqemgate04.nvidia.com id ; Mon, 08 Aug 2011 19:05:14 -0700 Received: from hqnvemgw02.nvidia.com ([172.17.108.22]) by hqnvupgp07.nvidia.com (PGP Universal service); Mon, 08 Aug 2011 19:06:47 -0700 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Mon, 08 Aug 2011 19:06:47 -0700 Received: from thelma.nvidia.com (Not Verified[172.16.212.77]) by hqnvemgw02.nvidia.com with MailMarshal (v6, 7, 2, 8378) id ; Mon, 08 Aug 2011 19:06:47 -0700 Received: from dilan-ubuntu.nvidia.com (dhcp-10-19-106-168.nvidia.com [10.19.106.168]) by thelma.nvidia.com (8.13.8+Sun/8.8.8) with ESMTP id p7926gFM021007; Mon, 8 Aug 2011 19:06:43 -0700 (PDT) From: dilee@nvidia.com To: rpurdie@rpsys.net, lethal@linux-sh.org, akpm@linux-foundation.org, arun.murthy@stericsson.com, rmorell@nvidia.com, linus.walleij@stericsson.com Cc: jnien@nvidia.com, swarren@nvidia.com, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, Dilan Lee Subject: [PATCH] video: Add a callback 'notify_after' for backlight control Date: Tue, 9 Aug 2011 10:05:25 +0800 Message-Id: <1312855525-21464-1-git-send-email-dilee@nvidia.com> X-Mailer: git-send-email 1.7.6 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 (demeter2.kernel.org [140.211.167.43]); Tue, 09 Aug 2011 02:06:49 +0000 (UTC) From: Dilan Lee We need a callback to do some things after pwm_enable, pwm_disable and pwm_config. This may be necessary to properly sequence timing on certain devices. For example, GPIO backlight_en has to be risen after pwm has been enabled to meet panel power on sequence defined in panel specification. Signed-off-by: Dilan Lee Reviewed-by: Robert Morell --- drivers/video/backlight/pwm_bl.c | 11 ++++++++++- include/linux/pwm_backlight.h | 1 + 2 files changed, 11 insertions(+), 1 deletions(-) diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index b8f38ec..e92e6e0 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -27,7 +27,9 @@ struct pwm_bl_data { unsigned int period; unsigned int lth_brightness; int (*notify)(struct device *, - int brightness); + int brightness); + void (*notify_after)(struct device *, + int brightness); int (*check_fb)(struct device *, struct fb_info *); }; @@ -55,6 +57,10 @@ static int pwm_backlight_update_status(struct backlight_device *bl) pwm_config(pb->pwm, brightness, pb->period); pwm_enable(pb->pwm); } + + if (pb->notify_after) + pb->notify_after(pb->dev, brightness); + return 0; } @@ -105,6 +111,7 @@ static int pwm_backlight_probe(struct platform_device *pdev) pb->period = data->pwm_period_ns; pb->notify = data->notify; + pb->notify_after = data->notify_after; pb->check_fb = data->check_fb; pb->lth_brightness = data->lth_brightness * (data->pwm_period_ns / data->max_brightness); @@ -172,6 +179,8 @@ static int pwm_backlight_suspend(struct platform_device *pdev, pb->notify(pb->dev, 0); pwm_config(pb->pwm, 0, pb->period); pwm_disable(pb->pwm); + if (pb->notify_after) + pb->notify_after(pb->dev, 0); return 0; } diff --git a/include/linux/pwm_backlight.h b/include/linux/pwm_backlight.h index 5e3e25a..63d2df4 100644 --- a/include/linux/pwm_backlight.h +++ b/include/linux/pwm_backlight.h @@ -14,6 +14,7 @@ struct platform_pwm_backlight_data { unsigned int pwm_period_ns; int (*init)(struct device *dev); int (*notify)(struct device *dev, int brightness); + void (*notify_after)(struct device *dev, int brightness); void (*exit)(struct device *dev); int (*check_fb)(struct device *dev, struct fb_info *info); };