From patchwork Fri May 19 20:05:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 13249148 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 E1A09C77B7F for ; Sat, 20 May 2023 09:59:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AA44410E149; Sat, 20 May 2023 09:58:50 +0000 (UTC) Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by gabe.freedesktop.org (Postfix) with ESMTPS id 657EB10E47D for ; Fri, 19 May 2023 20:05:36 +0000 (UTC) Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-3f42711865eso23462325e9.0 for ; Fri, 19 May 2023 13:05:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shruggie-ro.20221208.gappssmtp.com; s=20221208; t=1684526734; x=1687118734; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=unGGcWMXSxlIkISO/XPChAGC5INeHx+xymr7hphOHTk=; b=k5Guw/07AnhDpxjKB8UcXAAmZWcQ5O3JowQVJ8laPyua71EN/rsYssN/IFPaFpkVpI TNQ3Unj6O43cAdOO+OlJb/KWDnruigOlVvcsww9kNmV0PUazy0v2IbPDWbOOOPXT46IK gb2tn8Hf/7Bg0Lu5ehkHUxiwM3yKMAO1UQ2MwV2DKEkEB946eY0I3G1Gxks2hY+Ydn7W ecXUt3qg+NzSrGI0M2vHUQcH7ryHNXhU1MzhxtbmTvYxXhHlz6txRv/tGxamizDCnjzp i2DRuPB/RPO5+nSINoDpkwQxIm/dOb0kmar0qY5Mm/EYGnDK2PDeXlgtmjuPcYIxJN/+ M8uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684526734; x=1687118734; 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=unGGcWMXSxlIkISO/XPChAGC5INeHx+xymr7hphOHTk=; b=e4NEnyBMrzVhFDhcmikvYbeyZDZ6EZk9fnni70Bq8eu9YxLZtQZ8UdfHa0TsiQgwTC FUi6fVKymUZxaFzltTGmi4IF5yvoNhVY3EvzUdWLkTm+q56KghhzTQIrW7Ae5VxFeqwa 83bPTp5fbtYfT21EVpwLdEsbhRg/LdCzjDae6TIAnemvVbLnDOzFmhGpczQSbpFmmA34 YS8IdcunHTiWjDAHbW6AZOHUGo2bWK5m4QkWvwzXApmQWuNDVJnYIutbhOqj0GZ2kzlp ++/CMsBeJwKX8KXbG5QfSTqTrtSHj8/chE9FjXUqshcxjF6zGJ4sMt+f7cH/xMavsSaI 6TWg== X-Gm-Message-State: AC+VfDzjrMCN4z+CANbf24ypIIGoX/0kEqggPQLndvZx9WWEzTnZ1ttv NMxSiZ0zm6Q1yWu88LjblEXwE41/PcrBy+unpmXWLg== X-Google-Smtp-Source: ACHHUZ7ga4CZxLiQQKfdmi4Xqh4DykUfMWEgzKKffEXW7eHm0kD86vFODcQqOLeT733JRNm32EOAfA== X-Received: by 2002:a1c:7303:0:b0:3f1:9acf:8682 with SMTP id d3-20020a1c7303000000b003f19acf8682mr2044341wmb.17.1684526733947; Fri, 19 May 2023 13:05:33 -0700 (PDT) Received: from localhost.localdomain ([188.27.132.2]) by smtp.gmail.com with ESMTPSA id q3-20020adfea03000000b002fe96f0b3acsm6220329wrm.63.2023.05.19.13.05.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 13:05:33 -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 1/2] backlight: gpio_backlight: add new property default-brightness-level Date: Fri, 19 May 2023 23:05:19 +0300 Message-Id: <20230519200520.10657-1-alex@shruggie.ro> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Mailman-Approved-At: Sat, 20 May 2023 09:58:49 +0000 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, Philippe CORNU , 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: Philippe CORNU Signed-off-by: Yannick Fertre Signed-off-by: Alexandru Ardelean Reviewed-by: Daniel Thompson --- Link to original patch: https://github.com/STMicroelectronics/linux/commit/c4067d7bd883c6fa14ffd49892c4ce663cdafe98 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); From patchwork Fri May 19 20:05:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 13249145 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 E3540C77B7F for ; Sat, 20 May 2023 09:58:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9645710E13C; Sat, 20 May 2023 09:58:49 +0000 (UTC) Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by gabe.freedesktop.org (Postfix) with ESMTPS id 49A4B10E078 for ; Fri, 19 May 2023 20:05:37 +0000 (UTC) Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-30948709b3cso1705289f8f.3 for ; Fri, 19 May 2023 13:05:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shruggie-ro.20221208.gappssmtp.com; s=20221208; t=1684526735; x=1687118735; 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=Dhk36Zm9kcZS6s/7QkUBwDpZCpJODd1UkmAk+ko7ofs=; b=lFddv1Xx7+aPZjnuJK/BNYdmR8nlXfjsnu2AfYrhh7BYshp1lzes5QgQmT8Nhc/gBL KCc6xtnn/dDsF6gi7C6YIJROVs7pvOVZnvCZejZ7ey69pbvMzBs0EhpaXbM5AmCGUnb5 gGH8L5TA3JLdPqgiLlxcIegGfCFQaMOyh3YSCRjWpGi8bmeJ9J7C5rYazwbHsPAQMTtr w7Qde26UkLiaeMT93GpPAhIOQ20R39oN+YLgF0h5UYtM/AOcigpxfR8LCo1xVORSNXKI 2GgcpH9pjx4n4PdWkfJoO8bs8I5D/YPUTpaXrVJRRGHV6ZZRLa1EL8ph1Yhfc9FLOvq0 w6rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684526735; x=1687118735; 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=Dhk36Zm9kcZS6s/7QkUBwDpZCpJODd1UkmAk+ko7ofs=; b=UArtTHh2NAXuQ09qnWjkWdau5Ci46AbxLHd1tkHVvebS5kcE3lN4pQX9EpcwdLdMi2 JQ2xIamQbjJki/kC2W0oqUZ+g5rCd532Rt+DUkzcjaadRYcWHsItskpHZT+doExI5Aqz vOFLs7OGTIKmHCJIJ2n7bmwL8V8RMyvUDaLIl8qWaAo673ozjfAW6jYX4s+sn8frb6ia dIacuEcNFDScDpPfHx2jcA4M8Q0cUF3HC1wIgDWTXM3oFiPoNTihvzBrJLdtbLhgw1t4 6E9s8p1ZHEDxK0SOFfUGUFRX04lAgq0u6HeXOUO8LIhenvFB2n3Cpg6cQEpXy68xg42t K2Zw== X-Gm-Message-State: AC+VfDwhjZunDrIsd/SIagc8Np7X+usDq9kM6+NA/g60f0QCMlMNmJIu tShxKpT6FvsUs3W0+zQwVCrBZAxbPp1Uv3Y8+fSe+g== X-Google-Smtp-Source: ACHHUZ7/5/41nm0I7TwCks1heDFNmOyLJILcAtVDJl+PWPTeQg8QiNNU9BXxnomI8I+UZzBMfl7Fcg== X-Received: by 2002:a05:6000:c3:b0:304:6762:2490 with SMTP id q3-20020a05600000c300b0030467622490mr2871230wrx.3.1684526735223; Fri, 19 May 2023 13:05:35 -0700 (PDT) Received: from localhost.localdomain ([188.27.132.2]) by smtp.gmail.com with ESMTPSA id q3-20020adfea03000000b002fe96f0b3acsm6220329wrm.63.2023.05.19.13.05.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 May 2023 13:05:34 -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 2/2] dt-bindings: backlight: document new property default-brightness-level Date: Fri, 19 May 2023 23:05:20 +0300 Message-Id: <20230519200520.10657-2-alex@shruggie.ro> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230519200520.10657-1-alex@shruggie.ro> References: <20230519200520.10657-1-alex@shruggie.ro> MIME-Version: 1.0 X-Mailman-Approved-At: Sat, 20 May 2023 09:58:49 +0000 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, Philippe CORNU , 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. Reviewed-by: Philippe CORNU Signed-off-by: Yannick Fertre Signed-off-by: Alexandru Ardelean --- Link to original patch: https://github.com/STMicroelectronics/linux/commit/c4067d7bd883c6fa14ffd49892c4ce663cdafe98 .../bindings/leds/backlight/gpio-backlight.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Documentation/devicetree/bindings/leds/backlight/gpio-backlight.yaml b/Documentation/devicetree/bindings/leds/backlight/gpio-backlight.yaml index 584030b6b0b9..b96c08cff0f0 100644 --- a/Documentation/devicetree/bindings/leds/backlight/gpio-backlight.yaml +++ b/Documentation/devicetree/bindings/leds/backlight/gpio-backlight.yaml @@ -23,6 +23,15 @@ properties: description: enable the backlight at boot. type: boolean + default-brightness-level: + description: + The default brightness level (index into the array defined by the + "brightness-levels" property). + $ref: /schemas/types.yaml#/definitions/uint32 + +dependencies: + default-brightness-level: [ "brightness-levels" ] + required: - compatible - gpios