From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793826961; b=mQ+LfkqYA9FP4lt3IEEOAPVC364pCQ91+FjTenhxYcDm8oKLOVWot6au/u4chEL4Ie1n Xvbkk2q3PgpSgRniuHynBXs2S7arZJVVtYEK6MiWY7y954uW++CiXP/i5wafK1PSrcvBE USCx8dRCcUETXEFgPb53KFmo42jA39jWlKSZi8R4s4a/PH9M9pXrV4BclmSXVSk7i5ym3 tveA6PrDUndYzx17MUWgjGh/sLLXKUwYzvCs0QWLpDX/zE8KS7yq4EU3rimd/F3R0Wz7b yV1LqGclQ2ogXc51j2HqQAuR164pSKX7putWP+0QcVKWK7RnECOyWr7g6hkV3mVGtWg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793826961; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=amW/xnRbMYXteH23oG9EdAmpcZa8Qw/sRcp+8mkr0MU=; b=Jd/Qvpj8VVSdR1C1N8HVrDdVe2CvY85WiC14CHzCcBkYZN2hS63ce2hOokTYk9CIEVeJ IwYh8D9N/gD6mq0857uceShB+omQJ/hU5g+dfXZ1PjSgBnTMCJwV0r4ICITnxtdVQVeeZ c9LurS7j+uq4XhH/KmQeGwZzdhhgiwI/t9Vo9VaF0GV0cAzGPvb8Wo5h42PSvKl+XsOWS pkHd6mEmssw4Lqk3fCFhiyK2N6INuE2M41vTACPHncSnxVAQomaco8dHJd7UJr/z4TFK9 cUyl0QQIYHmQMiXImzLmS/DNVD7hJQPyrSiB4/sZebymY2EHe1JhXxbrxxUT+PCWhyQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=D2BkQ0sp; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AD007606A33D; Wed, 4 Nov 2026 21:16:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=D2BkQ0sp Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17EF41F000C1; Wed, 4 Nov 2026 21:15:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1793826960; bh=amW/xnRbMYXteH23oG9EdAmpcZa8Qw/sRcp+8mkr0MU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=D2BkQ0spsV/hwv+dc3w5HC4pYUfWfUEJc7fhMvXz2z2Vql0Ua602YaDLCJ40DqNsa 8/SwgyPNJieRs5xebb9/DMdPdso17sYxF9bkLQZKjxHqNoiGI6tUZ2+8+a8W/3xB3t C20H9l8lMKQ0XvBTlIN1xSbGFCdW0X0jxoS2WVc4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, David Heidelberg , "Daniel Thompson (RISCstar)" , Lee Jones Subject: [PATCH 7.3 111/547] backlight: qcom-wled: Fix unbalanced OVP IRQ enable at probe Date: Wed, 4 Nov 2026 16:04:55 -0500 Message-ID: <20261104211041.362421097@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261104211038.406938024@linuxfoundation.org> References: <20261104211038.406938024@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: David Heidelberg commit 5eda6b51461932f9fd835ef9e4574650c69c4fe8 upstream. wled_configure_ovp_irq() derives the initial state of the OVP interrupt from the hardware: /* Keep OVP irq disabled until module is enabled */ if (!(val & WLED3_CTRL_REG_MOD_EN_MASK)) disable_irq(wled->ovp_irq); but wled->brightness, which is what the rest of the driver uses to tell whether the module is on, is left at zero. On boards where the bootloader hands the kernel a lit backlight the two disagree. MOD_EN is already set, so the interrupt is left enabled, while wled_update_status() still believes the backlight is off and takes if (!!brightness != !!wled->brightness) rc = wled_module_enable(wled, !!brightness); on the first backlight update. wled_module_enable() then schedules wled_ovp_work(), which calls enable_irq() on the already enabled interrupt: Unbalanced enable for IRQ 176 WARNING: CPU: 0 PID: 160 at kernel/irq/manage.c:774 __enable_irq+0x50/0x80 Hardware name: Xiaomi Pocophone F1 (DT) Workqueue: events wled_ovp_work Call trace: __enable_irq+0x50/0x80 enable_irq+0x48/0xa0 wled_ovp_work+0x18/0x24 process_one_work+0x1d0/0x350 worker_thread+0x13c/0x460 kthread+0x110/0x114 ret_from_fork+0x10/0x20 The bootloader is not the only way to get there. The readback runs after wledN_setup(), and wled4_setup() sets MOD_EN itself on the path where the sink configuration does not already match, as does the tail of wled_auto_string_detection(), which all three setup paths can reach through wled_auto_detection_at_init(). A cold-booted board with a dark panel can therefore reach the same disagreement. Move the MOD_EN readback into wled_probe() and use it to seed wled->brightness, so the driver starts out agreeing with the hardware, and key the OVP interrupt off wled->brightness instead. The first backlight update then only reprograms the brightness registers and leaves both the module and the interrupt alone. The OVP interrupt also stays armed from probe whenever the module is already enabled, rather than being disabled at probe and only enabled once something writes brightness. Note that a backlight update requesting brightness 0 before any non-zero one now really does turn the module off wherever MOD_EN was already set, where before it was silently ignored. wled->brightness is seeded with default-brightness rather than the level the bootloader actually programmed, so the first update can still step the brightness. Reading that level back is version specific and is done in a follow-up, to keep this fix small enough to backport. Assisted-by: LLM Fixes: 8663c188beea ("backlight: qcom-wled: Add auto string detection logic") Cc: stable@vger.kernel.org Signed-off-by: David Heidelberg Reviewed-by: Daniel Thompson (RISCstar) Link: https://patch.msgid.link/20260921-qcom-wled-backlight-v4-3-bab8c7ef73cb@ixit.cz Signed-off-by: Lee Jones Signed-off-by: Greg Kroah-Hartman --- drivers/video/backlight/qcom-wled.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) --- a/drivers/video/backlight/qcom-wled.c +++ b/drivers/video/backlight/qcom-wled.c @@ -1627,7 +1627,6 @@ static int wled_configure_ovp_irq(struct struct platform_device *pdev) { int rc; - u32 val; wled->ovp_irq = platform_get_irq_byname(pdev, "ovp"); if (wled->ovp_irq < 0) { @@ -1643,13 +1642,8 @@ static int wled_configure_ovp_irq(struct return 0; } - rc = regmap_read(wled->regmap, wled->ctrl_addr + - WLED3_CTRL_REG_MOD_EN, &val); - if (rc < 0) - return rc; - - /* Keep OVP irq disabled until module is enabled */ - if (!(val & WLED3_CTRL_REG_MOD_EN_MASK)) + /* Keep the OVP irq disabled until the module is enabled */ + if (!wled->brightness) disable_irq(wled->ovp_irq); return 0; @@ -1665,6 +1659,7 @@ static int wled_probe(struct platform_de struct backlight_device *bl; struct wled *wled; struct regmap *regmap; + u32 mod_en; u32 val; int rc; @@ -1735,6 +1730,24 @@ static int wled_probe(struct platform_de INIT_DELAYED_WORK(&wled->ovp_work, wled_ovp_work); + val = WLED_DEFAULT_BRIGHTNESS; + of_property_read_u32(pdev->dev.of_node, "default-brightness", &val); + + /* + * The module may already be enabled, either by a bootloader that left + * the backlight lit or by the setup above. Record that, so that the + * first brightness update does not enable an already enabled module, + * and so that the OVP irq is armed from probe rather than from that + * first update. + */ + rc = regmap_read(wled->regmap, wled->ctrl_addr + WLED3_CTRL_REG_MOD_EN, + &mod_en); + if (rc < 0) + return rc; + + if (mod_en & WLED3_CTRL_REG_MOD_EN_MASK) + wled->brightness = val; + rc = wled_configure_short_irq(wled, pdev); if (rc < 0) return rc; @@ -1743,9 +1756,6 @@ static int wled_probe(struct platform_de if (rc < 0) return rc; - val = WLED_DEFAULT_BRIGHTNESS; - of_property_read_u32(pdev->dev.of_node, "default-brightness", &val); - memset(&props, 0, sizeof(struct backlight_properties)); props.type = BACKLIGHT_RAW; props.brightness = val;