From patchwork Thu Sep 19 14:06:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 11153899 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E2F931745 for ; Fri, 20 Sep 2019 07:52:33 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CBB0320C01 for ; Fri, 20 Sep 2019 07:52:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CBB0320C01 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rasmusvillemoes.dk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E84766F57F; Fri, 20 Sep 2019 07:51:41 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 26F466F860 for ; Thu, 19 Sep 2019 14:06:33 +0000 (UTC) Received: by mail-lj1-x244.google.com with SMTP id j19so2249679lja.1 for ; Thu, 19 Sep 2019 07:06:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=k4SJ+eSfjSAP63ushly3GU0Efl4ebkKBMuWTSOkSqS8=; b=duWib8OTB2uABFRSXkQiA9nkYx28bzdufPlp+0yEqBQXdN2xNqwgkvTQFiD0e2FP5g Sn8Y8k3KeVwVpJB3kwJk9knKDVjsPYQcBK2xqhwtalKKdJpiLqMy14LiuqqqLKcd3B3n TVVADyQxUa96vfQxHvpmLGQc8jGxn225la9nV6MgejSePox03tZisW0/J80e4KulBEP6 2KO1o1hEwcSwDjgUCCR8CvZ2w09LiVqNV6rVauNfZqgYIBIeIVFBc0YeRAJSiN9HVruT Fwn+XaLmP/IamEhf0GaoEyFk9XbHPqw5TFwrOHynBKazVZsLFoayMIWbiIEk4riag/9N 8GxA== X-Gm-Message-State: APjAAAUE2WcfnMb99lmHPHmXwXu7wEO7Sjf5jinjtnJSqNJ3Cb71Rqdj 0b+R6b6UqzlPJfzAt/DXpNOJtw== X-Google-Smtp-Source: APXvYqzlHJRhLqL82K2xKbtjAXAMpinhzWwpvMBA7qVfJ7tNQ26aw9X0BviaTA3hpMKKf3q8cAewtQ== X-Received: by 2002:a2e:934f:: with SMTP id m15mr5586940ljh.101.1568901991526; Thu, 19 Sep 2019 07:06:31 -0700 (PDT) Received: from prevas-ravi.prevas.se ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id h3sm1687886ljf.12.2019.09.19.07.06.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2019 07:06:31 -0700 (PDT) From: Rasmus Villemoes To: Thierry Reding , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz Subject: [PATCH 3/5] backlight: pwm_bl: drop use of int_pow() Date: Thu, 19 Sep 2019 16:06:18 +0200 Message-Id: <20190919140620.32407-3-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190919140620.32407-1-linux@rasmusvillemoes.dk> References: <20190919140620.32407-1-linux@rasmusvillemoes.dk> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 20 Sep 2019 07:51:40 +0000 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=k4SJ+eSfjSAP63ushly3GU0Efl4ebkKBMuWTSOkSqS8=; b=W4FhrPJAR9Dqgs5qFA5Pl22WVgeXGbokdSlE6Xjl8ev+AwkvtlovQkmnKhocbnMFdS 81B7iYoNdsvMs2yQlsvxAdJGvvAKDR0FvjYPLiSIbpwUt9AMKu8kvddB2vIg68Gs3TZA XspHxRzEPQhGFNCyXRy2eUNIWhGekZOWx5Sfw= X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pwm@vger.kernel.org, linux-fbdev@vger.kernel.org, Rasmus Villemoes , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The scheduler uses a (currently private) fixed_power_int() in its load average computation for computing powers of numbers 0 < x < 1 expressed as fixed-point numbers, which is also what we want here. But that requires the scale to be a power-of-2. We could (and a following patch will) change to use a power-of-2 scale, but for a fixed small exponent of 3, there's no advantage in using repeated squaring. Signed-off-by: Rasmus Villemoes Reviewed-by: Daniel Thompson --- drivers/video/backlight/pwm_bl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index 9252d51f31b9..aee6839e024a 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -179,7 +179,8 @@ static u64 cie1931(unsigned int lightness, unsigned int scale) if (lightness <= (8 * scale)) { retval = DIV_ROUND_CLOSEST(lightness * 10, 9033); } else { - retval = int_pow((lightness + (16 * scale)) / 116, 3); + retval = (lightness + (16 * scale)) / 116; + retval *= retval * retval; retval = DIV_ROUND_CLOSEST_ULL(retval, (scale * scale)); }