From patchwork Fri May 20 07:35:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Lu X-Patchwork-Id: 9128815 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CEB7360762 for ; Fri, 20 May 2016 07:35:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C159625D91 for ; Fri, 20 May 2016 07:35:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B61AA27A84; Fri, 20 May 2016 07:35:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 48FB725D91 for ; Fri, 20 May 2016 07:35:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754949AbcETHfv (ORCPT ); Fri, 20 May 2016 03:35:51 -0400 Received: from mga01.intel.com ([192.55.52.88]:9865 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753719AbcETHfu (ORCPT ); Fri, 20 May 2016 03:35:50 -0400 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP; 20 May 2016 00:35:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,338,1459839600"; d="scan'208";a="811108465" Received: from aaronlu.sh.intel.com ([10.239.13.110]) by orsmga003.jf.intel.com with ESMTP; 20 May 2016 00:35:36 -0700 Date: Fri, 20 May 2016 15:35:36 +0800 From: Aaron Lu To: Valdis.Kletnieks@vt.edu Cc: "Rafael J. Wysocki" , "Rafael J. Wysocki" , Linux Kernel Mailing List , ACPI Devel Maling List , Len Brown Subject: Re: linux-next 20160512 - ACPI issue with screen brightness Message-ID: <20160520073536.GB30152@aaronlu.sh.intel.com> References: <4736.1463510462@turing-police.cc.vt.edu> <6459.1463698397@turing-police.cc.vt.edu> <7208.1463713500@turing-police.cc.vt.edu> <6674547c-cefb-1b93-893a-7c5909a180a7@intel.com> <2897.1463727728@turing-police.cc.vt.edu> <20160520071720.GA30152@aaronlu.sh.intel.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160520071720.GA30152@aaronlu.sh.intel.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Fri, May 20, 2016 at 03:17:20PM +0800, Aaron Lu wrote: > On Fri, May 20, 2016 at 03:02:08AM -0400, Valdis.Kletnieks@vt.edu wrote: > > On Fri, 20 May 2016 13:45:30 +0800, Aaron Lu said: > > > On 05/20/2016 11:05 AM, Valdis.Kletnieks@vt.edu wrote: > > > > On Thu, 19 May 2016 18:53:17 -0400, Valdis.Kletnieks@vt.edu said: > > > > > > > >>>> next-20160512 sets the screen brightness to about 40%-ish or so, rather > > > >>>> than the 100% intensity I want. > > > > > > Do you mean after boot, the screen brightness is now 40% instead of the > > > previous 100%? Are you using a GUI? > > > > Nope, even the very first line of output from initramfs is dim, and if I then > > reboot and go into the BIOS settings, the screen intensity is at 40%. While > > it's rebooting, the Dell bios splash will start off bright and then suddenly > > dim down. > > > > With the patches reverted: > > > > [/sys/class/backlight/acpi_video0] grep . *bright* > > actual_brightness:95 > > brightness:95 > > max_brightness:95 > > > > And the weird part inside the kernel - on a kernel that has the problem, > > /sys/class/backlight is *empty* - only '.' and '..' entries. > > > > No, I don't understand why the acpi_video0 entry isn't created when that > > commit is in place. > > The commit probably makes acpi_video_init_brightness bail out for some > reason, adding debug prints under those "if (result)" in > acpi_video_init_brightness should help to identify where it goes wrong. Like the below one: --- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c index 3d5b8a099351..69b321580fa3 100644 --- a/drivers/acpi/acpi_video.c +++ b/drivers/acpi/acpi_video.c @@ -323,8 +323,10 @@ acpi_video_device_lcd_query_levels(acpi_handle handle, *levels = NULL; status = acpi_evaluate_object(handle, "_BCL", NULL, &buffer); - if (!ACPI_SUCCESS(status)) + if (!ACPI_SUCCESS(status)) { + pr_err("acpi_evaluate_BCL failed, %d\n", status); return status; + } obj = (union acpi_object *)buffer.pointer; if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) { printk(KERN_ERR PREFIX "Invalid _BCL data\n"); @@ -765,13 +767,13 @@ int acpi_video_get_levels(struct acpi_device *device, if (!ACPI_SUCCESS(acpi_video_device_lcd_query_levels(device->handle, &obj))) { - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Could not query available " - "LCD brightness level\n")); + pr_err("Could not query available LCD brightness level\n"); result = -ENODEV; goto out; } if (obj->package.count < 2) { + pr_err("_BCL count smaller than 2, %d\n", obj->package.count); result = -EINVAL; goto out; } @@ -786,6 +788,7 @@ int acpi_video_get_levels(struct acpi_device *device, br->levels = kmalloc((obj->package.count + 2) * sizeof *(br->levels), GFP_KERNEL); if (!br->levels) { + pr_err("kmalloc for br->levels failed\n"); result = -ENOMEM; goto out_free; } @@ -870,8 +873,10 @@ acpi_video_init_brightness(struct acpi_video_device *device) int result = -EINVAL; result = acpi_video_get_levels(device->dev, &br); - if (result) + if (result) { + pr_err("acpi_video_get_levels failed, %d\n", result); return result; + } device->brightness = br; /* _BQC uses INDEX while _BCL uses VALUE in some laptops */ @@ -882,12 +887,16 @@ acpi_video_init_brightness(struct acpi_video_device *device) result = acpi_video_device_lcd_get_level_current(device, &level_old, true); - if (result) + if (result) { + pr_err("acpi_video_device_lcd_get_level_current failed, %d\n", result); goto out_free_levels; + } result = acpi_video_bqc_quirk(device, max_level, level_old); - if (result) + if (result) { + pr_err("acpi_video_bqc_quirk failed, %d\n", result); goto out_free_levels; + } /* * cap._BQC may get cleared due to _BQC is found to be broken * in acpi_video_bqc_quirk, so check again here. @@ -910,11 +919,12 @@ acpi_video_init_brightness(struct acpi_video_device *device) set_level: result = acpi_video_device_lcd_set_level(device, level); - if (result) + if (result) { + pr_err("acpi_video_device_lcd_set_level failed, %d\n", result); goto out_free_levels; + } - ACPI_DEBUG_PRINT((ACPI_DB_INFO, - "found %d brightness levels\n", br->count - 2)); + pr_info("found %d brightness levels\n", br->count - 2); return 0; out_free_levels: