From nobody Sun Feb 8 23:05:25 2026 Received: from mail.prodrive-technologies.com (mail.prodrive-technologies.com [212.61.153.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D76822FE566; Tue, 11 Nov 2025 20:51:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.61.153.67 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762894275; cv=none; b=ZijZfKklyg6tlXhbpL/8gknIiD7qQT5Q0sz8l0dwxzu/y2QS14I4wxwOTojFKDKFK6U7tnBkrOPenSg9CRrp+ib3ftMNuzxoK5HGyDZ3B07Sptq3lgTPfxlhL3bJ0r3UZ3eiJDBfWbxG7UfK4Mq8cUpIlkXoXmvt488ErzHYGLQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762894275; c=relaxed/simple; bh=5EuORCmQwU612AxD8Jii/M8es3nwbeh6cIbTThrubR0=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=OFalgVNz8viUJrZ7ybH+8CWA/97G75c8F5LS+nVJdP0QJK6qRZdJUu7HRYd8ekygQfTTbSaV1QuHwImUvmOrNdarPhpXj3V5LgmvvEzp7K2GkzTnnyfB43x24UnbyzfqDclxdG4mhSwbf7Wnq/BlbdAAuZ3uIhYJatlF3fkSMnM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=prodrive-technologies.com; spf=pass smtp.mailfrom=prodrive-technologies.com; arc=none smtp.client-ip=212.61.153.67 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=prodrive-technologies.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=prodrive-technologies.com Received: from EXCOP01.bk.prodrive.nl (10.1.0.22) by EXCOP01.bk.prodrive.nl (10.1.0.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 11 Nov 2025 21:46:02 +0100 Received: from lnxdevrm02.prodrive.nl (10.1.1.121) by EXCOP01.bk.prodrive.nl (10.1.0.22) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Tue, 11 Nov 2025 21:46:02 +0100 From: Martijn de Gouw To: Lee Jones , Pavel Machek CC: Martijn de Gouw , , Subject: [PATCH] leds: group-multicolor: Add support for initial value. Date: Tue, 11 Nov 2025 21:45:55 +0100 Message-ID: <20251111204556.2803878-1-martijn.de.gouw@prodrive-technologies.com> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" It's possible to set a default state for leds in the dts with 'default-state', but this was not reflected when the LEDs are grouped. This patch adds support for keeping the default-state value. Signed-off-by: Martijn de Gouw --- drivers/leds/rgb/leds-group-multicolor.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/leds/rgb/leds-group-multicolor.c b/drivers/leds/rgb/le= ds-group-multicolor.c index 548c7dd63ba1e..b3e46a51dfbc7 100644 --- a/drivers/leds/rgb/leds-group-multicolor.c +++ b/drivers/leds/rgb/leds-group-multicolor.c @@ -69,6 +69,7 @@ static int leds_gmc_probe(struct platform_device *pdev) struct mc_subled *subled; struct leds_multicolor *priv; unsigned int max_brightness =3D 0; + unsigned int default_brightness =3D 0; int i, ret, count =3D 0, common_flags =3D 0; =20 priv =3D devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); @@ -96,6 +97,12 @@ static int leds_gmc_probe(struct platform_device *pdev) =20 max_brightness =3D max(max_brightness, led_cdev->max_brightness); =20 + /* If any LED is on, set brightness to the max brightness. + * The actual brightness of the LED is set as intensity value. + */ + if (led_cdev->brightness) + default_brightness =3D max_brightness; + count++; } =20 @@ -109,14 +116,16 @@ static int leds_gmc_probe(struct platform_device *pde= v) =20 subled[i].color_index =3D led_cdev->color; =20 - /* Configure the LED intensity to its maximum */ - subled[i].intensity =3D max_brightness; + /* Configure the LED intensity to its current brightness */ + subled[i].intensity =3D DIV_ROUND_CLOSEST(led_cdev->brightness * max_bri= ghtness, + led_cdev->max_brightness); } =20 /* Initialise the multicolor's LED class device */ cdev =3D &priv->mc_cdev.led_cdev; cdev->brightness_set_blocking =3D leds_gmc_set; cdev->max_brightness =3D max_brightness; + cdev->brightness =3D default_brightness; cdev->color =3D LED_COLOR_ID_MULTI; priv->mc_cdev.num_colors =3D count; =20 --=20 2.39.2