Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp21998423rwd; Fri, 30 Jun 2023 02:29:10 -0700 (PDT) X-Google-Smtp-Source: APBJJlGBRQN/vqqDSvEwiF4mA5/mC6fOdtI6lMWe70lI/TDihLsh0VQ/3h61LRse0N6V+alO41g7 X-Received: by 2002:a05:6a20:1613:b0:12d:5f4b:c52b with SMTP id l19-20020a056a20161300b0012d5f4bc52bmr1987695pzj.28.1688117350222; Fri, 30 Jun 2023 02:29:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688117350; cv=none; d=google.com; s=arc-20160816; b=zuSldmzAUFW9SpJIgNh7wkw7dU/2b8YoKFItYMT7GIjCNBKL7TH8giKZoJvJI2HJK1 Jc5OreCHyqHuXq/x63x+nuJi1MHq1GJPtDmBvHE6PKVKqj358fb4OAfSqwmPsurITjYK NACmhqKweT1xIz2+yawhTuL5iLdAW2ykNry97e+LWtN3gAmjr9GRejcSqb0STEJFAcmj zKs4ZDQGnbuxe7PFAT/dFPYw3f9H9NGVXZs6KvrAHP4cQEKxrYX0WSjPT3qjMYz7yFt7 U0ZBLf8TmDL9ZmELjoJoiuvFOIEV16BBUXSOsSfLlNfm6r99X/8Ln8XkkVG7V+iXUGGW Jtvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uE5OMXYXB2+yRj3yLCn944N+1hg6y2gWCtsPAuJlZKY=; fh=BvDGf3suoxznn31feb7LyalEdcBJTACH17F4ilBge3w=; b=HOZnVCxHMNttsuffmetM0rJAs53Azg5Q/tPAVEx9hxvr43YpTxmtrpJU468kQXskS8 Uj24WdOxRRt/Ed+uuW8JyrgNvFhcUe985FFrQKfGAb9Jl6JztEOQqkZb2UrcWOxTs8rp Qob1JZFOrrAWSIk6+h7JdJ+FLzSa3P2vUwEmFQlp15nEVDAORmhPtj3a36PkS+Aw2Ob2 oreWPnV63o94fHjpT1m43QTf8mZYYmBMn+AkfIG02y+ses/HuJi0B89cxJo+fO4Iv121 755Z6JorUmfwhIYlhtcquwv7Ic9ZPvoH0mYFbY9vK9CT7S9bC1HdeXNRyQZNMdCUr+mp WGrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b=I1MV2no0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d7-20020a656207000000b00553854417e2si12467829pgv.244.2023.06.30.02.28.55; Fri, 30 Jun 2023 02:29:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b=I1MV2no0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232400AbjF3JXZ (ORCPT + 99 others); Fri, 30 Jun 2023 05:23:25 -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 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 --- 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; -- 2.30.2