From patchwork Fri Dec 2 21:17:24 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seth Forshee X-Patchwork-Id: 128982 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 54890B6F6B for ; Sat, 3 Dec 2011 08:17:51 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1RWaUK-0006ax-BG; Fri, 02 Dec 2011 21:17:44 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1RWaUI-0006ai-9f for kernel-team@lists.ubuntu.com; Fri, 02 Dec 2011 21:17:42 +0000 Received: from 64-126-113-183.dyn.everestkc.net ([64.126.113.183] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1RWaUI-0004Bp-0h for kernel-team@lists.ubuntu.com; Fri, 02 Dec 2011 21:17:42 +0000 From: Seth Forshee To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/1][Oneiric SRU] Platform: Detect samsung laptop quirk when initial level is zero Date: Fri, 2 Dec 2011 15:17:24 -0600 Message-Id: <1322860644-8536-2-git-send-email-seth.forshee@canonical.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1322860644-8536-1-git-send-email-seth.forshee@canonical.com> References: <1322860644-8536-1-git-send-email-seth.forshee@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com From: John Serock This patch depends on the "Platform: Brightness quirk for samsung laptop driver" patch from Jason Stubbs. This patch adds a check for an initial brightness level of 0; if the level is 0, this patch changes the brightness level to 1 before the driver attempts to detect the brightness quirk. The Samsung N150 netbook experiences the brightness quirk. Without Jason's patch, the only brightness levels available on the N150 are 0, 1, and 8. This patch ensures that, when the initial brightness level is 0, the samsang-laptop driver detects the brightness quirk on the N150, thereby making brightness levels 0 through 8 available. Signed-off-by: John Serock Acked-by: Jason Stubbs Signed-off-by: Matthew Garrett (cherry picked from commit ba05b237372bad82533d1f717569d1d817ff3c27) BugLink: http://bugs.launchpad.net/bugs/810093 Signed-off-by: Seth Forshee Acked-by: Herton Ronaldo Krzesinski --- drivers/platform/x86/samsung-laptop.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c index c32dc39..e553486 100644 --- a/drivers/platform/x86/samsung-laptop.c +++ b/drivers/platform/x86/samsung-laptop.c @@ -404,8 +404,9 @@ static int get_brightness(struct backlight_device *bd) static void check_for_stepping_quirk(void) { - u8 initial_level = read_brightness(); + u8 initial_level; u8 check_level; + u8 orig_level = read_brightness(); /* * Some laptops exhibit the strange behaviour of stepping toward @@ -414,6 +415,11 @@ static void check_for_stepping_quirk(void) * around in set_brightness. */ + if (orig_level == 0) + set_brightness(1); + + initial_level = read_brightness(); + if (initial_level <= 2) check_level = initial_level + 2; else @@ -427,7 +433,7 @@ static void check_for_stepping_quirk(void) pr_info("enabled workaround for brightness stepping quirk\n"); } - set_brightness(initial_level); + set_brightness(orig_level); } static int update_status(struct backlight_device *bd)