From patchwork Wed Jun 21 21:54:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 13287986 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id DAB75EB64D8 for ; Wed, 21 Jun 2023 21:55:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 44A4410E360; Wed, 21 Jun 2023 21:55:16 +0000 (UTC) Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by gabe.freedesktop.org (Postfix) with ESMTPS id C543D10E35F for ; Wed, 21 Jun 2023 21:55:09 +0000 (UTC) Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-51a426e4f4bso7640390a12.1 for ; Wed, 21 Jun 2023 14:55:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shruggie-ro.20221208.gappssmtp.com; s=20221208; t=1687384505; x=1689976505; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Jn/Beteqm9A/LN1S7WLvnvRia249hgTE4o7LFlD5jW8=; b=npbSrNQ6pLZxRDO4iQBtGYduK/HsPHl+AGKV9spEmgzGe0BpEo+C3nRotLaWy5cKU2 VpuVo+RZWhplXLWA9+t6OXb5TqnmIofJayaBIISKDeuIovO2ASqIwHJiRnT1gz9/w7tL nYmMtq+gWD7SopokiNjxfwbSnVIo1hWxLUGjw1+Iz4hb6anmNCrEutXimGHEapRdFbXG 1GIuA0MMS/g9fvDFsIZxGIqADMyO2Fgmuh3Pm2X6dr4eq6IyBKusoHNU+vA9KXodvBFp Lscod8GaAQkGDsdJWsu2ruEcOls1KzAzn/HoDe9dd6+Y4UNQyBmD2XjnoxtwzyzcyBAo f4rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687384505; x=1689976505; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Jn/Beteqm9A/LN1S7WLvnvRia249hgTE4o7LFlD5jW8=; b=W0osO0Cz2KrXnj+dRt60Fw1c62CXtHo1RAXte4yl8rps8lQeR22nAo7nLlNB+RFFPL zXuUOagXAGrAvrnix6JkJI1tlkzax6F4bs0SO4yMuWbJmBiZQUW8tJZelhuWFisUDPAf jrCBRevTYmSkoFnEIaWch9fH1uMX60XgIcctda2FGNo6DMg+y61FdU2TwHtzSvdGgO+G ADonn7cwaPXES/zGs9nk7+4x2Z+6e3j0hZUcuGm71tReoHoTQH1ynWOHFoXS61G4Cg3R Gt+M0vL9L0oXDijxELm1sM6Ichl1zefXEd60FqOtGtiuh1QvtqRSwWMouMjUSVYxrz6c hECw== X-Gm-Message-State: AC+VfDw6Wj7dq113A9wL/e2KxHqFfKXp0zKSIkAqCVelIK28aXdOy9Ef /11N4KyWO1PfXAgaJ+ON05eVk3G2mz7deAlv81lpoA== X-Google-Smtp-Source: ACHHUZ6A/T43INsBruKaaE+va76RJMnbtzFL7HfR52IyaTewoA0XaNKUwjNnTX5qkrnskkylIa+1vw== X-Received: by 2002:aa7:d404:0:b0:51b:dcb7:9b45 with SMTP id z4-20020aa7d404000000b0051bdcb79b45mr2164807edq.10.1687384504976; Wed, 21 Jun 2023 14:55:04 -0700 (PDT) Received: from localhost.localdomain ([188.27.132.2]) by smtp.gmail.com with ESMTPSA id d16-20020aa7d5d0000000b0051a358a76c9sm3115417eds.72.2023.06.21.14.55.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jun 2023 14:55:04 -0700 (PDT) From: Alexandru Ardelean To: dri-devel@lists.freedesktop.org, linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org Subject: [PATCH v2 1/2] dt-bindings: backlight: document new property default-brightness-level Date: Thu, 22 Jun 2023 00:54:56 +0300 Message-Id: <20230621215457.11297-1-alex@shruggie.ro> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: daniel.thompson@linaro.org, pavel@ucw.cz, jingoohan1@gmail.com, deller@gmx.de, lee@kernel.org, conor+dt@kernel.org, Alexandru Ardelean , robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, Yannick Fertre Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Yannick Fertre Add documentation for new default-brightness-level property. Signed-off-by: Yannick Fertre Signed-off-by: Alexandru Ardelean --- Link to original patch: https://github.com/STMicroelectronics/linux/commit/c4067d7bd883c6fa14ffd49892c4ce663cdafe98 Changelog v1 -> v2: * https://lore.kernel.org/dri-devel/20230519200520.10657-2-alex@shruggie.ro/ * removed 'brightness-levels' reference * updated doc-text for 'default-brightness-level' * updated doc-text for 'default-on' * added 'minimum' & 'maximum' to 'default-brightness-level' property * removed 'Reviewed-by: Philippe CORNU ' as requested * patch is first in series of 2 patches (was second patch) .../bindings/leds/backlight/gpio-backlight.yaml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/leds/backlight/gpio-backlight.yaml b/Documentation/devicetree/bindings/leds/backlight/gpio-backlight.yaml index 584030b6b0b9..2da6552a207c 100644 --- a/Documentation/devicetree/bindings/leds/backlight/gpio-backlight.yaml +++ b/Documentation/devicetree/bindings/leds/backlight/gpio-backlight.yaml @@ -20,9 +20,21 @@ properties: maxItems: 1 default-on: - description: enable the backlight at boot. + description: + The default power state of the backlight at boot. type: boolean + default-brightness-level: + description: + The default brightness level on device init. The value can be 0 or 1. + If omitted, the value is 1. In the context of the "gpio-backlight" driver + the effect of this setting will be that the backlight is on/off. + The difference between this setting and "default-on" is that this handles + brightness, while "default-on" handles the power setting of the device. + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 1 + required: - compatible - gpios From patchwork Wed Jun 21 21:54:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 13287985 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 995CBC001DD for ; Wed, 21 Jun 2023 21:55:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1840910E356; Wed, 21 Jun 2023 21:55:11 +0000 (UTC) Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by gabe.freedesktop.org (Postfix) with ESMTPS id AE32010E356 for ; Wed, 21 Jun 2023 21:55:09 +0000 (UTC) Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-51878f8e541so7567679a12.3 for ; Wed, 21 Jun 2023 14:55:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shruggie-ro.20221208.gappssmtp.com; s=20221208; t=1687384506; x=1689976506; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kRUDsn4e6Ks8YzmKCfn5h1mpk0f1GA6PVcpiiIMFAtA=; b=ryqDqOAnnAJv9G8ZbZBMXI5Qf+NLTe4Z9G/CWY3yA0+dio5cKumyowL69kJfe4FSZ4 3/YwzXdHBxwfWqgXBexKcev4SCbeY75p0+Quq+Bsmx0dkRqAKi2foN/NHk93KSSNpt2G 9valT+R/D0YupatdQ9mJ8e5ogQnivBeohbZwy6luFduk0m0SvbuZiIrjiL16lPrlLM2U MfxFXJLqzPuZB48nubuzvOwBk/aLqDI2j+FKXY3iB8oBsDhng/Hr87OGMFObUMd0MQdI SedfW0L6q9PhuH+pS1qiEl/qbActqTHvoDcdHM/LKVs+o4yDOGpAUSke/eC4IuFGqaGh C7gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687384506; x=1689976506; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kRUDsn4e6Ks8YzmKCfn5h1mpk0f1GA6PVcpiiIMFAtA=; b=YXvvmsmOn1nSwepHVNZcoMR8rInDjAnQ5joA4C64jEEBJr5HGUV0TvMAXRV9KILphB 2lAQjhtefq0YAMF3VO6Die8J1jEBJVlB1vFzoklZ8ymGZO3sEJgHOPEjIan1MYjJ7KiS usic14xKLuyv8C6k8B9FyKiJVjKQg8yecNdkE4Is7z8W+mNx8uR3leujfyIDghD2MckI UF0pDGg8oxaFFILG1N+TBD6N2O7nYwgrIuImfxocFfPZgaAC+HJqwZfaOndPChRmEeCr ZKIA4lEaoqYBg0bsxevdTRS9ofqZVJHsfgum9X6DGIt15z6GKZ9+DUc2cwkzULTlWFhD hj0Q== X-Gm-Message-State: AC+VfDxtaJEGESoV/RwPrPf+CIY26azPnMJNX/k+MjHgGE6TOLa3JIci CYqBAr+sbmhUQHzayG1tuvlr+348Vv0ylSofAI1bSA== X-Google-Smtp-Source: ACHHUZ68KU6zeF4KhP/4rSB+WCwcso3Hz0SCmqZuTCSqxgmUfmsCgyUVJ5ghWnoL72nCuOtxLztz5A== X-Received: by 2002:aa7:c3cc:0:b0:51a:4b53:e3f9 with SMTP id l12-20020aa7c3cc000000b0051a4b53e3f9mr7987253edr.31.1687384506197; Wed, 21 Jun 2023 14:55:06 -0700 (PDT) Received: from localhost.localdomain ([188.27.132.2]) by smtp.gmail.com with ESMTPSA id d16-20020aa7d5d0000000b0051a358a76c9sm3115417eds.72.2023.06.21.14.55.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jun 2023 14:55:05 -0700 (PDT) From: Alexandru Ardelean To: dri-devel@lists.freedesktop.org, linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org Subject: [PATCH v2 2/2] backlight: gpio_backlight: add new property default-brightness-level Date: Thu, 22 Jun 2023 00:54:57 +0300 Message-Id: <20230621215457.11297-2-alex@shruggie.ro> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230621215457.11297-1-alex@shruggie.ro> References: <20230621215457.11297-1-alex@shruggie.ro> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: daniel.thompson@linaro.org, pavel@ucw.cz, jingoohan1@gmail.com, deller@gmx.de, lee@kernel.org, conor+dt@kernel.org, Alexandru Ardelean , robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, Yannick Fertre Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Yannick Fertre Add new property to set a brightness by default at probe. Reviewed-by: Daniel Thompson Signed-off-by: Yannick Fertre Signed-off-by: Alexandru Ardelean --- Link to original patch: https://github.com/STMicroelectronics/linux/commit/c4067d7bd883c6fa14ffd49892c4ce663cdafe98 Changelog v1 -> v2: * https://lore.kernel.org/dri-devel/20230519200520.10657-1-alex@shruggie.ro/ * removed 'Reviewed-by: Philippe CORNU ' as requested * patch is now second patch of 2 (was first in series) * added 'Reviewed-by: Daniel Thompson ' drivers/video/backlight/gpio_backlight.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c index 6f78d928f054..d3fa3a8bef4d 100644 --- a/drivers/video/backlight/gpio_backlight.c +++ b/drivers/video/backlight/gpio_backlight.c @@ -53,6 +53,7 @@ static int gpio_backlight_probe(struct platform_device *pdev) struct backlight_device *bl; struct gpio_backlight *gbl; int ret, init_brightness, def_value; + u32 value; gbl = devm_kzalloc(dev, sizeof(*gbl), GFP_KERNEL); if (gbl == NULL) @@ -93,7 +94,11 @@ static int gpio_backlight_probe(struct platform_device *pdev) else bl->props.power = FB_BLANK_UNBLANK; - bl->props.brightness = 1; + ret = device_property_read_u32(dev, "default-brightness-level", &value); + if (!ret && value <= props.max_brightness) + bl->props.brightness = value; + else + bl->props.brightness = 1; init_brightness = backlight_get_brightness(bl); ret = gpiod_direction_output(gbl->gpiod, init_brightness);