From patchwork Fri Jun 30 09:22:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Astrid Rost X-Patchwork-Id: 698376 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20E10EB64DD for ; Fri, 30 Jun 2023 09:23:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232365AbjF3JXI (ORCPT ); Fri, 30 Jun 2023 05:23:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229522AbjF3JWx (ORCPT ); Fri, 30 Jun 2023 05:22:53 -0400 Received: from smtp1.axis.com (smtp1.axis.com [195.60.68.17]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F6DA35AE; Fri, 30 Jun 2023 02:22:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1688116972; x=1719652972; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uE5OMXYXB2+yRj3yLCn944N+1hg6y2gWCtsPAuJlZKY=; b=I1MV2no0SiofVx6QIEjjSboQ/PHgESH5ZmRNOg3KEDUGQmg7XcV9Z0d8 V8v8/jyFGQmh4E6lHGKbMpNaPe06NUt0rKYb30zzNzjz7lN4oemplIX+5 5NibNpNgaCeyKehwRWRAf9Cpin/IooOE1oryx33uIXY709ZMNGU0SCvSY 5WyL0rE3hbbDbUPQ2XOjkkCwZStW003c1D4d1SkqxUOOnnSdpNeJENmtE 1WiWldN2Xk/nI8BFqCbKqtidxiPjQtJctKwdHKgOXc7l91xfQUPYj5wpR atiSoJVuQ3vAez6b8RYPLlD6QABir2TN7d/yBjmsJ4CGjYUZ/LukgjPDP g==; From: Astrid Rost To: Andy Shevchenko , Krzysztof Kozlowski , Rob Herring , "Jacek Anaszewski" , Pavel Machek , "Lee Jones" CC: , Astrid Rost , , Subject: [PATCH v2 1/2] led: led-class: Read max-brightness from devicetree Date: Fri, 30 Jun 2023 11:22:46 +0200 Message-ID: <20230630092248.4146169-2-astrid.rost@axis.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230630092248.4146169-1-astrid.rost@axis.com> References: <20230630092248.4146169-1-astrid.rost@axis.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org Add max-brightness in order to reduce the current on the connected LEDs. Normally, the maximum brightness is determined by the hardware, and this property is not required. This property is used to set a software limit. It could happen that an LED is made so bright that it gets damaged or causes damage due to restrictions in a specific system, such as mounting conditions. Note that led-max-microamp should be preferably used, if it is supported by the controller. Signed-off-by: Astrid Rost Reviewed-by: Andy Shevchenko --- drivers/leds/led-class.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index 9255bc11f99d..ce652abf9336 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c @@ -457,6 +457,10 @@ int led_classdev_register_ext(struct device *parent, if (fwnode_property_present(init_data->fwnode, "retain-state-shutdown")) led_cdev->flags |= LED_RETAIN_AT_SHUTDOWN; + + fwnode_property_read_u32(init_data->fwnode, + "max-brightness", + &led_cdev->max_brightness); } } else { proposed_name = led_cdev->name; From patchwork Fri Jun 30 09:22:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Astrid Rost X-Patchwork-Id: 698225 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2EEBEB64DA for ; Fri, 30 Jun 2023 09:23:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232465AbjF3JXJ (ORCPT ); Fri, 30 Jun 2023 05:23:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231140AbjF3JWz (ORCPT ); Fri, 30 Jun 2023 05:22:55 -0400 Received: from smtp2.axis.com (smtp2.axis.com [195.60.68.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F97535AF; Fri, 30 Jun 2023 02:22:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1688116975; x=1719652975; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Jp23SoY0A89Wy3Z2zA4/6qa4NlchrQutGkx1p0uuPYk=; b=qLirsg7ufImVJ9OJleQz85WTnEKRlIG5N/akCRiU2OnciJB7vsPPRFfT tFrx2djsweiz+M5+dP5iZakxZpARNU9XyvKT9JdBaSiPNorkT+BR2NeFK 5ZFBR7wFoHWRSPhg8ukemSoO1/oA4Xq0efgKR+GtEVURpcv6rHTVYSC13 uwlX4HvGFIgTy+MP/ZlllUlgymZcd8X3Ac8BjCyVtxf09hUANUMq1iYQM g9O7TX3kF3UDiflzOUnnGUaciTadi7JV1ltcDpnwjdh3/NeGxl5bh54gd uLFG3KZ0AeFrJQNEh+MfkJMz2A5ELm/GDPhZqQLu44HQfL2RMwqAhYeQi w==; From: Astrid Rost To: Andy Shevchenko , Krzysztof Kozlowski , Rob Herring , "Jacek Anaszewski" , Pavel Machek , "Lee Jones" , Rob Herring , Conor Dooley CC: , Astrid Rost , , , Subject: [PATCH v2 2/2] dt-bindings: leds: Read max-brightness from devicetree Date: Fri, 30 Jun 2023 11:22:47 +0200 Message-ID: <20230630092248.4146169-3-astrid.rost@axis.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230630092248.4146169-1-astrid.rost@axis.com> References: <20230630092248.4146169-1-astrid.rost@axis.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org Add max-brightness in order to reduce the current on the connected LEDs. Normally, the maximum brightness is determined by the hardware, and this property is not required. This property is used to set a software limit. It could happen that an LED is made so bright that it gets damaged or causes damage due to restrictions in a specific system, such as mounting conditions. Note that led-max-microamp should be preferably used, if it is supported by the controller. Signed-off-by: Astrid Rost Reviewed-by: Rob Herring --- Documentation/devicetree/bindings/leds/common.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Documentation/devicetree/bindings/leds/common.yaml b/Documentation/devicetree/bindings/leds/common.yaml index 11aedf1650a1..603a5630fc3d 100644 --- a/Documentation/devicetree/bindings/leds/common.yaml +++ b/Documentation/devicetree/bindings/leds/common.yaml @@ -160,6 +160,16 @@ properties: For flash LED controllers with configurable current this property is mandatory for the LEDs in the non-flash modes (e.g. torch or indicator). + max-brightness: + description: + Normally, the maximum brightness is determined by the hardware, and + this property is not required. This property is used to set a software + limit. It could happen that an LED is made so bright that it gets damaged + or causes damage due to restrictions in a specific system, such as + mounting conditions. Note that led-max-microamp should be preferably used, + if it is supported by the controller. + $ref: /schemas/types.yaml#definitions/uint32 + panic-indicator: description: This property specifies that the LED should be used, if at all possible,