Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp26263095rwd; Mon, 3 Jul 2023 07:28:52 -0700 (PDT) X-Google-Smtp-Source: APBJJlG+sNsUm4XNauTa1lbYbenLCEDeVeeS8xlBE6nEMZSWZNUP/5OHO8qc7wMXQDXQAyojqtyz X-Received: by 2002:a17:902:d50c:b0:1b8:76cb:604f with SMTP id b12-20020a170902d50c00b001b876cb604fmr12318442plg.20.1688394532053; Mon, 03 Jul 2023 07:28:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688394532; cv=none; d=google.com; s=arc-20160816; b=yhtNpfDu3HhtyDrEvxhgk6fFfWJxBiS6FqvTwg23Q2I5g88mz0MXKwrxUVtkta7smI dPEYq3+IytuPqIu1EjUDMg/mfFymO+AGlcRO77U+HTGwpXSqXzWH7M/3c2h+/VwL1HO0 3DoRgJzx0OPjA9k+n8sigon4+x++aAATSsuJ/cda8mpxmVdhbPryjue5yfd7dhUfqxmT UTsSa/r9163fNMZ6J3cZ+KSQ3402qSvkEpHNVyMtQ9UVxAxjmthEg1nlBpdGaVJuiYg2 ygQOZpJf//XkVWuvv53hQ1ZZWcw8MZmbJ/8fuE3ZrLCw3oZ2kPHtnSB7EDBRFQtMi7M/ eykQ== 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=TYt/Wl7+6P6oL1evdV9w4Bhsj/jfKiJKvoP0+SizWS4=; fh=BvDGf3suoxznn31feb7LyalEdcBJTACH17F4ilBge3w=; b=GPjeT7KbWBKSM1WoKWpkyPVVkMp5tUI5MQUjPuX/DjWDCdYaXqQ5WLpM/bjn5nPZm1 9GPqQwSsy6GVsmRXPSAujFouhV5RfP5Z+DCHRSxpu0Ay6dy8pnLVen5myudZ8qa07cgn Yj6XIh+KP4zDdc6gqVxjPWF+H0dlCwhhMUC14gn4UGMqRx3wHb42cYgmTRUqHGzw3TRQ jaFckBJHfj9NIEbipYXRG3t1TeX8j9CZOSHb1+vLOSY7U5geBTibMg91i8pdVtw5/u3I TB9e/8qrNYskBgXWRZOPaZJCffNcUadm0Oo1ELQ174xZclzJJYH7mnK9l5UJKfHUl4GF bmyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b=JtlM+ApU; 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 m1-20020a170902db0100b001b88e609e56si3877036plx.488.2023.07.03.07.28.36; Mon, 03 Jul 2023 07:28:52 -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=JtlM+ApU; 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 S231262AbjGCND3 (ORCPT + 99 others); Mon, 3 Jul 2023 09:03:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229738AbjGCND1 (ORCPT ); Mon, 3 Jul 2023 09:03:27 -0400 Received: from smtp1.axis.com (smtp1.axis.com [195.60.68.17]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AA4CE58; Mon, 3 Jul 2023 06:03:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1688389406; x=1719925406; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=TYt/Wl7+6P6oL1evdV9w4Bhsj/jfKiJKvoP0+SizWS4=; b=JtlM+ApUukjKIlguhjLewKD6MRYJTL27Bu+It9yOmfNXWwmfGfRSA22w oR2XyRn868kTvSWtdbVIqixMndiBTwpgs2zTKJCYBKmuDft34EAI3EdGi ZBf1J+yo5yUnF29WicA15El3Ar4gh60W/WedADbkKhu8r+7dyu3pt3WGL JV+MJNxV/0T7IzQrKxeMKRhcvNQNKhEf9igR5T3ldaZUVlbYLTfVfnDwo BFNmyG00B3joq3ZQMWLlVqsDxLd0vxaUIFHLOAOUOwHUC6ZU4bhqT0P9e zFBFA2fQ644SyomydKQpOv7QQZKhljoLio9ONew179yTtuKYjmMP5mr6i w==; From: Astrid Rost To: Andy Shevchenko , Krzysztof Kozlowski , Rob Herring , "Jacek Anaszewski" , Pavel Machek , "Lee Jones" CC: , Astrid Rost , , Subject: [PATCH v3 2/2] led: led-class: Read max-brightness from devicetree Date: Mon, 3 Jul 2023 15:03:13 +0200 Message-ID: <20230703130313.548519-3-astrid.rost@axis.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230703130313.548519-1-astrid.rost@axis.com> References: <20230703130313.548519-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 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 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 this flag is mainly used for PWM-LEDs, where it is not possible to map brightness to current. Drivers for other controllers should use led-max-microamp. Reviewed-by: Andy Shevchenko 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