Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8266992ybi; Tue, 9 Jul 2019 12:16:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqxWblks191LLB2wzuqM9nhkpf9vTj5moByAx7AKyKYa964vZQ9diqrM1gpQsQ3D6t8KaHEm X-Received: by 2002:a17:902:1e9:: with SMTP id b96mr34358034plb.277.1562699812001; Tue, 09 Jul 2019 12:16:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562699811; cv=none; d=google.com; s=arc-20160816; b=E805Nwc67wIs16//KszfhKbyly2UGdMiiQrPoH1MdWbr5etnXVEnkOxKQq6AiqVyEA kUazMB6BP/ouV19YNAgMzQP333hIgbkdGR5xAbJprtmGH+eF4jzC3belcSXG4uJfUkW1 0YFt16E6mDbGD4AaJ7XRDFhbAPpYemgP3wI6zSwg29VMsOUDif/yfo5QjPEVHSKEzVBd b9cTzxxvdx7XXGtK22FfhOqYzwI5VhxWZGjv9vSxWeA4LC5cTfFj641phWfZq3rQWtV8 md1VQsJ7SlbQb/HJ9WEwlYtokqdTwQv4HAoYE/PL1VqtB+KRXvJihSnEnQg1pyy4FW6q I26A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kVvpaDbzpEWbBjYARfR8dh/gP0bxxZgHm+m/Jkyi7lE=; b=naGGRzyaLnDIhk3GijSuF4PQNeVSWdrhIcp3icntBpsJQ6svO4kZD3zoirBObMrgTr nHn8xqVNrjjKiJ4gHW+c5AibkD/1iUmRhfWhVQ8fqXqC/B8ba73lRO/CgX524FtBe3H5 bYmjDLuuL1en9TYDBKPAVod1WcNU9xiF9CAbzTcoEAyMJ17a+Q3J3fCecHHcWXOK+8Re mOOCxfZfS5k1G1STkj1qGJDG0mBvpiCt5kD9ZNDtFUdNviSbQ16SPb7ufAvI84wKiYkA 737DEBXqsK2TJeAkGkuoRZeVhzBhUWfQlK7s3egdEo7xTAUmIazZl4GozYo70WxIWIUv dLZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ml+EGHk2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t25si13475394pgl.7.2019.07.09.12.16.35; Tue, 09 Jul 2019 12:16:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ml+EGHk2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729253AbfGITAT (ORCPT + 99 others); Tue, 9 Jul 2019 15:00:19 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:38718 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727726AbfGITAS (ORCPT ); Tue, 9 Jul 2019 15:00:18 -0400 Received: by mail-pg1-f195.google.com with SMTP id z75so9915992pgz.5 for ; Tue, 09 Jul 2019 12:00:17 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=kVvpaDbzpEWbBjYARfR8dh/gP0bxxZgHm+m/Jkyi7lE=; b=ml+EGHk2gBbO+Ix+y3IXBdYnqYmz2DJ80cGljmi3CgE65/Et2Vg5hVrN5terF5lHFL S8tCFSnVYVpvKoafo00DLzPqA9hwRTKA8NY6EdeYlR4aSVKABT4hmSAr0Q9X7SnlphZC jHDTSVqfquQ6omSj4rf4xOaEmRWxY5QFJmPZQ= 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=kVvpaDbzpEWbBjYARfR8dh/gP0bxxZgHm+m/Jkyi7lE=; b=Q0EsF0ggm7naY/kERNE+15XKmDWTPLzJCcMPAquvkHejnAN9qiJVtHQ9o7G7VSIkqn 0/vx1p2QjQ2o6cpMEY21IHZ17WovTmZ81b7JUEPpiOXknzYttInoDpqTfDv9kkC+OdVu VrcSBaOVp4zc1pHSczvxDggrjFIJYhJUFfPW2YNPOutAY8ji6mjqUK9G5me/ZZ7Cp00v zViillsMViOBgqvDbGzuyD6V8ZvWj1dpnFRHtT0es1IULSGSZonKzMDVVfGwy1JDdwH/ j66KpTTIM7YIT2Hg92/E2zkWRn8UrqIAwamqPQ+KRMO8fOGjSPaBDa9yRzEN6+GotDyj A3Wg== X-Gm-Message-State: APjAAAXAieirxbAxs11LnNOYvCSzRdB8s52k4SLsAK/DjM1UxXMyq1pg l+Z6mHBa+7drayEiXrJoVCW8eg== X-Received: by 2002:a17:90a:c58e:: with SMTP id l14mr1789873pjt.104.1562698817408; Tue, 09 Jul 2019 12:00:17 -0700 (PDT) Received: from localhost ([2620:15c:202:1:75a:3f6e:21d:9374]) by smtp.gmail.com with ESMTPSA id o14sm2998437pjp.19.2019.07.09.12.00.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jul 2019 12:00:16 -0700 (PDT) From: Matthias Kaehlcke To: Thierry Reding , Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz Cc: linux-pwm@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, Enric Balletbo i Serra , Douglas Anderson , Brian Norris , Pavel Machek , Jacek Anaszewski , Matthias Kaehlcke Subject: [PATCH v3 3/4] backlight: pwm_bl: Set scale type for CIE 1931 curves Date: Tue, 9 Jul 2019 12:00:06 -0700 Message-Id: <20190709190007.91260-4-mka@chromium.org> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog In-Reply-To: <20190709190007.91260-1-mka@chromium.org> References: <20190709190007.91260-1-mka@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For backlight curves calculated with the CIE 1931 algorithm set the brightness scale type to non-linear. This makes the scale type available to userspace via the 'scale' sysfs attribute. Signed-off-by: Matthias Kaehlcke Tested-by: Enric Balletbo i Serra Acked-by: Daniel Thompson --- Changes in v3: - mark scale as non-linear instead of using the CIE1931 type which has been removed - updated commit message Changes in v2: - added Enric's 'Tested-by' tag - added Daniel's 'Acked-by' tag --- drivers/video/backlight/pwm_bl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index fb45f866b923..7c6dfc4a601d 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -553,6 +553,8 @@ static int pwm_backlight_probe(struct platform_device *pdev) goto err_alloc; } + memset(&props, 0, sizeof(struct backlight_properties)); + if (data->levels) { /* * For the DT case, only when brightness levels is defined @@ -591,6 +593,8 @@ static int pwm_backlight_probe(struct platform_device *pdev) pb->levels = data->levels; } + + props.scale = BACKLIGHT_SCALE_NON_LINEAR; } else { /* * That only happens for the non-DT case, where platform data @@ -601,7 +605,6 @@ static int pwm_backlight_probe(struct platform_device *pdev) pb->lth_brightness = data->lth_brightness * (state.period / pb->scale); - memset(&props, 0, sizeof(struct backlight_properties)); props.type = BACKLIGHT_RAW; props.max_brightness = data->max_brightness; bl = backlight_device_register(dev_name(&pdev->dev), &pdev->dev, pb, -- 2.22.0.410.gd8fdbe21b5-goog