From patchwork Tue Feb 6 18:13:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aren X-Patchwork-Id: 197618 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1758110dyb; Tue, 6 Feb 2024 11:09:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IFiX6udunIjo2rjfWu9kizFsKT/mxN7UnnsFTgOKeOksxzeLJI9pcbeaPaE739sCB1K/apw X-Received: by 2002:a17:903:186:b0:1d9:66de:ea0b with SMTP id z6-20020a170903018600b001d966deea0bmr2872967plg.37.1707246550904; Tue, 06 Feb 2024 11:09:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707246550; cv=pass; d=google.com; s=arc-20160816; b=HlLqP2q0Qe9o/2MdChzVE/HlthSD3OTlP+SC5ggj21TmOFlU0E/R2rY0g3KOWq6lds 25ds1pjfISXyud14Jh3QelKvnX2fUa47uWzkcrXnlpdkOFvPoi7KbARoUzqYtaJoiDjn g2DRU90g9qFdHLW3gVcNR1rUQu9QW0HfFgBWw8oki4e4AKHoFyW0jQjnS38ztTaC7i4K 2doNfsYTtA/v4tC0w43e5yio6H3IyfXs6VYqUyvPBF763Jx9iwUhXBTAjOoyVX+sGWxT +XKlg5tTgimBfe8cAIyJNUYFj6u9fgQ+Z845JzUhmoulkiZNZfUhLUVoSsz92KykK1MW 88Mw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=dkim-signature:content-transfer-encoding:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:message-id:date :subject:cc:to:from; bh=NQIirmVOCAxOql2DLF2KDYdkndurgToAOXdUzzfrUao=; fh=tsy7etqp54D+ypd5QzmLH/b4IG+VMgAYmTtd3ASGnkk=; b=NeMXfnsmu/D4uCTUeWiLeeNbpZJpvk3E0y15r1iNkv8uLc+Jv7O2CGEHOcK/mRfTLf eRu35IbS1fQdzDnj57I0FzqGOLaaOKeZqpAQaad7+MBn7nhRsqocVTLzEByaDDr/M2vn MsaLo8lIHh5pxnKTM5ph0vHhHNi2tRGpBycgOQOdzu+V9APz6Bq0Pc22788xXH8XRMW2 iUZlM/icM7cY1LIdj2FmZYH0O6T/JOhJvgdMAZiS0RTzbRiQDIlMwKsoMNOJT8Ln6unq iOt863D03Svt4bggXEYX7MzfqPyAJ6J1J3T4oKYjnJbLrYHKhHMrWESiaSuuA7/Kk54H 54bQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@peacevolution.org header.s=dkim header.b=AD8RDoDq; arc=pass (i=1 spf=pass spfdomain=peacevolution.org dkim=pass dkdomain=peacevolution.org dmarc=pass fromdomain=peacevolution.org); spf=pass (google.com: domain of linux-kernel+bounces-55531-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55531-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=peacevolution.org X-Forwarded-Encrypted: i=1; AJvYcCW/uGG/6kdVa2fLCfh9mxwj6jx2E7xIstG+x6DB+gxBSoo2tKcpa248i3QC8yrB4b2dCGpZJcpx+RLHTbATnZIdNcM5mQ== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id ji15-20020a170903324f00b001d9620e9ad4si350499plb.26.2024.02.06.11.09.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 11:09:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-55531-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@peacevolution.org header.s=dkim header.b=AD8RDoDq; arc=pass (i=1 spf=pass spfdomain=peacevolution.org dkim=pass dkdomain=peacevolution.org dmarc=pass fromdomain=peacevolution.org); spf=pass (google.com: domain of linux-kernel+bounces-55531-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55531-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=peacevolution.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 32275B27039 for ; Tue, 6 Feb 2024 19:04:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4848F179AF; Tue, 6 Feb 2024 19:03:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=peacevolution.org header.i=@peacevolution.org header.b="AD8RDoDq" Received: from a.peacevolution.org (a.peacevolution.org [206.189.193.133]) (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 122B5175BD; Tue, 6 Feb 2024 19:02:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=206.189.193.133 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707246178; cv=none; b=ddgi0iSNnESpPw5Xb2Gx6bi0HuirQfu6GLkX62mnL51Ie5gEe/dWY2cfT+EN5kO3mP1pVuYVlDL5UJyJpiVy+AL1WXLFwRmWtMUH3i3m+Za5PQmHSGjcgRDx2a1HG2sEjtGHbuGmXXA9/NnJBbDp8obz+wl0tPzJxaLq32UiDdM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707246178; c=relaxed/simple; bh=qXVPXyupoi6y4mfGDfx6l8JDOF1+lMDDn4mbVnSTzr0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=vE5C2+t6LWqlUP4zC3HHwiMEsfo5JSLT/1t4+1rgWo6JchBtRxKkLK+vZ8jqWbet9s8WnN4LV4Cq3Fx12BzrWEndsto1o1iqSFw5u2MnzYMqtjYX9g2/88pB/MGDF8W1LecuBHLxEjTiOIss+yaZmuMxdsK7tN934EmgDWku1qs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=peacevolution.org; spf=pass smtp.mailfrom=peacevolution.org; dkim=pass (1024-bit key) header.d=peacevolution.org header.i=@peacevolution.org header.b=AD8RDoDq; arc=none smtp.client-ip=206.189.193.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=peacevolution.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=peacevolution.org Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by a.peacevolution.org (Postfix) with ESMTPA id DD9644583E; Tue, 6 Feb 2024 19:02:48 +0000 (UTC) From: Aren Moynihan To: linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski , Rob Herring , devicetree@vger.kernel.org, Jean-Jacques Hiblot , Chen-Yu Tsai , Ondrej Jirman , linux-sunxi@lists.linux.dev, Lee Jones , Pavel Machek , linux-arm-kernel@lists.infradead.org, Jernej Skrabec , linux-leds@vger.kernel.org, Conor Dooley , Miles Alan , Samuel Holland , Aren Moynihan Subject: [PATCH v2 1/4] leds: rgb: leds-group-multicolor: allow leds to stay on in suspend Date: Tue, 6 Feb 2024 13:13:17 -0500 Message-ID: <20240206185400.596979-1-aren@peacevolution.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Authentication-Results: auth=pass smtp.auth=aren@peacevolution.org smtp.mailfrom=aren@peacevolution.org X-Spam-Level: **** X-Spamd-Bar: ++++ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=peacevolution.org; s=dkim; t=1707246170; h=from:subject:date:message-id:to:cc:mime-version:content-transfer-encoding; bh=NQIirmVOCAxOql2DLF2KDYdkndurgToAOXdUzzfrUao=; b=AD8RDoDqSuMzuW8WjS6hsO4Ihd7f8WOWW5QsXpSI7G+B3S/ZAOv9zFcgzVMoPwDLVcGvsZ 3jyUXi4dQD42GwETLjspanbyyc4gtnAGlP9du/NQeqpq3AQNfhm+zqS098d0N0cu3STJr2 Os7WmPNxQ97X0MQofjfo76Zlw56NSU0= X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790177759461998475 X-GMAIL-MSGID: 1790177759461998475 If none of the managed leds enable LED_CORE_SUSPENDRESUME, then we shouldn't need to set it here. This makes it possible to use multicolor groups with gpio leds that enable retain-state-suspended in the device tree. Signed-off-by: Aren Moynihan Acked-by: Pavel Machek --- Changes in v2: - make sure count gets initialized - send the patch to (hopefully) all the correct people this time drivers/leds/rgb/leds-group-multicolor.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/leds/rgb/leds-group-multicolor.c b/drivers/leds/rgb/leds-group-multicolor.c index 39f58be32af5..b6c7679015fd 100644 --- a/drivers/leds/rgb/leds-group-multicolor.c +++ b/drivers/leds/rgb/leds-group-multicolor.c @@ -69,7 +69,7 @@ static int leds_gmc_probe(struct platform_device *pdev) struct mc_subled *subled; struct leds_multicolor *priv; unsigned int max_brightness = 0; - int i, ret, count = 0; + int i, ret, count = 0, common_flags = 0; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) @@ -91,6 +91,7 @@ static int leds_gmc_probe(struct platform_device *pdev) if (!priv->monochromatics) return -ENOMEM; + common_flags |= led_cdev->flags; priv->monochromatics[count] = led_cdev; max_brightness = max(max_brightness, led_cdev->max_brightness); @@ -114,12 +115,15 @@ static int leds_gmc_probe(struct platform_device *pdev) /* Initialise the multicolor's LED class device */ cdev = &priv->mc_cdev.led_cdev; - cdev->flags = LED_CORE_SUSPENDRESUME; cdev->brightness_set_blocking = leds_gmc_set; cdev->max_brightness = max_brightness; cdev->color = LED_COLOR_ID_MULTI; priv->mc_cdev.num_colors = count; + /* we only need suspend/resume if a sub-led requests it */ + if (common_flags & LED_CORE_SUSPENDRESUME) + cdev->flags = LED_CORE_SUSPENDRESUME; + init_data.fwnode = dev_fwnode(dev); ret = devm_led_classdev_multicolor_register_ext(dev, &priv->mc_cdev, &init_data); if (ret)