From patchwork Tue Nov 11 20:30:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "U. Artie Eoff" X-Patchwork-Id: 5277381 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0A454C11AC for ; Tue, 11 Nov 2014 20:38:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4D6932015D for ; Tue, 11 Nov 2014 20:38:45 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 70C3D20179 for ; Tue, 11 Nov 2014 20:38:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 023326E03D; Tue, 11 Nov 2014 12:38:39 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id 0CBD16E03D for ; Tue, 11 Nov 2014 12:38:38 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 11 Nov 2014 12:38:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,362,1413270000"; d="scan'208";a="606153600" Received: from uartie-ird.jf.intel.com (HELO localhost.localdomain) ([10.7.199.145]) by orsmga001.jf.intel.com with ESMTP; 11 Nov 2014 12:38:02 -0800 From: "U. Artie Eoff" To: intel-gfx@lists.freedesktop.org Date: Tue, 11 Nov 2014 12:30:38 -0800 Message-Id: <1415737838-9640-1-git-send-email-ullysses.a.eoff@intel.com> X-Mailer: git-send-email 1.9.3 Subject: [Intel-gfx] [PATCH] drm/i915: expose a fixed brightness range to userspace X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 A userspace brightness range that is larger than the hardware brightness range does not have a 1:1 mapping and can result in brightness != actual_brightness for some values. Expose a fixed brightness range of [0..1000] to userspace so that all values can map 1:1 into the hardware brightness range. This would assume that the hardware range is always greater than 1000, otherwise we're right back to the original issue. This patch is based on Jani Nikula's proposed change in the referenced ML thread, except use the range [0..1000] instead; which was recommended by Jesse Barnes for smoother backlight transitions. Reference: http://lists.freedesktop.org/archives/intel-gfx/2014-November/055221.html Signed-off-by: U. Artie Eoff Tested-By: PRC QA PRTS (Patch Regression Test System Contact: shuang.he@intel.com) Reviewed-by: Jesse Barnes --- drivers/gpu/drm/i915/intel_panel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index 4d63839..f74f5f2 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c @@ -1057,7 +1057,7 @@ static int intel_backlight_device_register(struct intel_connector *connector) * Note: Everything should work even if the backlight device max * presented to the userspace is arbitrarily chosen. */ - props.max_brightness = panel->backlight.max; + props.max_brightness = 1000; props.brightness = scale_hw_to_user(connector, panel->backlight.level, props.max_brightness);