From patchwork Mon May 11 20:32:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 6383961 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DBCBC9F32B for ; Mon, 11 May 2015 20:32:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0308E20795 for ; Mon, 11 May 2015 20:32:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1A4DB2082E for ; Mon, 11 May 2015 20:32:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751378AbbEKUcR (ORCPT ); Mon, 11 May 2015 16:32:17 -0400 Received: from mail-yk0-f170.google.com ([209.85.160.170]:33047 "EHLO mail-yk0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751813AbbEKUcQ (ORCPT ); Mon, 11 May 2015 16:32:16 -0400 Received: by ykeo186 with SMTP id o186so40985529yke.0 for ; Mon, 11 May 2015 13:32:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=WXUMsEkiu869pVtMy6MsXIVJsK/xKRVkbZN7zFF8vFM=; b=g1MkboqhNeAJlAtc4pygX6I3qNMkALIZOrdp2IllnSlZUTAaIEq1Z+dEqpvr0PAFjH wNbeu0mMXoxrBapk3xHdVm6rjvOB2qofaRAjy9Bc7QuLBBfSWjvt2wEhrOeETNYpRNpV 7BFDfywahCl9z5DMsJFdi5fya7xvPKLyrx6E0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=WXUMsEkiu869pVtMy6MsXIVJsK/xKRVkbZN7zFF8vFM=; b=ZFYJTk3RIpCRJTuApoeCrJqDmV1md1EfnFmgjl86R6hkHzPf98lfRuJ/q7ICLZ7El/ oICZmK8wMpufTp/6XMj7yACnKLmptli9zai9BbMHCWSvJJnXmWxfValjTSEva7Dxf1n/ nY+LHkAhKxjOKZQWnX0GxDeSwjlyq1gYaLtcPkRwKFf+iL65THPeIcfX0aqhTjrbd5dC VGq5s43dPrUZNEe0Rq6ktvIIAnt13ce3FJLl9CEkisBnNypX1m0O88sLsN9fIYp0OZqx Gac8NLVQ549Yeh4D/rNP6O8bDmuiz/DDxwyFqfQflcckUwfqCXB1w5NjfjCDKs188kJD 0XZQ== X-Gm-Message-State: ALoCoQn2AVV759CbcjiVjLvYCAqt3XZ9Z3pxJFn8pFGt/G5Qh2qScejgMdtbdQMATi69ufUKENa7 X-Received: by 10.236.14.34 with SMTP id c22mr11780533yhc.159.1431376336234; Mon, 11 May 2015 13:32:16 -0700 (PDT) Received: from billyjoel.corp.google.com ([172.26.40.157]) by mx.google.com with ESMTPSA id s27sm13105064yho.9.2015.05.11.13.32.13 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 11 May 2015 13:32:15 -0700 (PDT) From: Sean Paul To: milo.kim@ti.com, linux-fbdev@vger.kernel.org, jg1.han@samsung.com Cc: cooloney@gmail.com, lee.jones@linaro.org, bleung@chromium.org, smbarber@chromium.org, Sean Paul Subject: [PATCH] backlight/lp855x: Don't clear level on suspend/blank Date: Mon, 11 May 2015 13:32:05 -0700 Message-Id: <1431376325-25741-1-git-send-email-seanpaul@chromium.org> X-Mailer: git-send-email 2.2.0.rc0.207.ga3a616c Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Don't clear the backlight level when we're going into suspend or blanking. Instead, just temporarily set the level to 0 so we retain the value when we resume. Reported-by: Benson Leung Tested-by: Stephen Barber Signed-off-by: Sean Paul Acked-by: Milo Kim Reviewed-by: Benson Leung --- drivers/video/backlight/lp855x_bl.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c index 08ae72f..74daf7c 100644 --- a/drivers/video/backlight/lp855x_bl.c +++ b/drivers/video/backlight/lp855x_bl.c @@ -257,21 +257,15 @@ static void lp855x_pwm_ctrl(struct lp855x *lp, int br, int max_br) static int lp855x_bl_update_status(struct backlight_device *bl) { struct lp855x *lp = bl_get_data(bl); + int brightness = bl->props.brightness; if (bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK)) - bl->props.brightness = 0; + brightness = 0; - if (lp->mode == PWM_BASED) { - int br = bl->props.brightness; - int max_br = bl->props.max_brightness; - - lp855x_pwm_ctrl(lp, br, max_br); - - } else if (lp->mode == REGISTER_BASED) { - u8 val = bl->props.brightness; - - lp855x_write_byte(lp, lp->cfg->reg_brightness, val); - } + if (lp->mode == PWM_BASED) + lp855x_pwm_ctrl(lp, brightness, bl->props.max_brightness); + else if (lp->mode == REGISTER_BASED) + lp855x_write_byte(lp, lp->cfg->reg_brightness, (u8)brightness); return 0; }