From nobody Fri Oct 2 08:24:50 2026 Received: from out-183.mta0.migadu.com (out-183.mta0.migadu.com [91.218.175.183]) (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 D3B4623EAAD for ; Tue, 4 Aug 2026 04:17:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.183 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785817059; cv=none; b=cTsir6bVFRObKtvMzl0V09p8nvTSY/YvAq9DTHFM9F9wxZxDekDqrD0DXvHXYauP3u9KbhCthgzRUzRg2Eyh0jrjGI9Uxx1kQ9qWYC6zW2PolvY1gcOTDhOWtriF3dnLkrHUoREG+AjgxnLy0Rfg0npBQS4L23EpEFyUrRshYQE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785817059; c=relaxed/simple; bh=nlCIUQdeomCvgK3j8vFmsSg/UUT/LjoK0D9KoWguSlo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fr79caHJj+zKKYuktNhvxM3o0wUHGmNigiRk59rp3H45r+xbUGQhr8rB8bkBNYmYKA9yzrbIu503Fg5lPEJeAvj+12aBO9YooCodJydmgOVoLzVmR9BIbxMjYdPpxtetinFoek/ypy7wbrlayKegijo1qWt3goViSC8/k9vFih0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=YLQoZPah; arc=none smtp.client-ip=91.218.175.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="YLQoZPah" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1785766406; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fLmFQghAKB0YhK4oz6/TkcbAFVqh6AWJi8TPUgEXZYs=; b=YLQoZPahNWx4mziCtiNuqWhmrNHNA8rV/3Y4HKIvbnwwhL0eKzpXM50HDwERpFQEx7o1DK s4hr7PZesKBZjh33MbKCjlj7vAxsuMOPkinG6SoweypPvtJTXxngfilV/Mm9yxHzmizDWp AiKo9VSj3HA5ftIPabefUbmeQdFf8UY= From: Junjie Cao To: Lee Jones , Daniel Thompson , Jingoo Han Cc: dri-devel@lists.freedesktop.org, linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Pengyu Luo Subject: [PATCH v2 1/3] backlight: aw99706: Fix DT property names to match binding Date: Mon, 3 Aug 2026 07:13:08 -0700 Message-ID: <20260803141310.1379194-2-junjie.cao@linux.dev> In-Reply-To: <20260803141310.1379194-1-junjie.cao@linux.dev> References: <20260803141310.1379194-1-junjie.cao@linux.dev> 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 X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" The driver reads four tuning properties without the unit suffixes that the binding mandates: "awinic,sw-freq" instead of "awinic,sw-freq-hz", "awinic,sw-ilmt" instead of "awinic,sw-ilmt-microamp", "awinic,iled-max" instead of "awinic,iled-max-microamp", and "awinic,uvlo-thres" instead of "awinic,uvlo-thres-microvolt". As a result, device_property_read_u32() never finds these properties in a binding-conformant device tree and silently falls back to the compiled-in defaults for switching frequency, switching current limit, max LED current, and UVLO threshold. Fix by aligning the property name strings in aw99706_dt_props[] with the binding. No value/range changes are needed since both sides already use the same units and enumerations. Fixes: 147b38a5ad06 ("backlight: aw99706: Add support for Awinic AW99706 ba= cklight") Cc: stable@vger.kernel.org Signed-off-by: Junjie Cao --- drivers/video/backlight/aw99706.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/video/backlight/aw99706.c b/drivers/video/backlight/aw= 99706.c index 18299faf06ad..e130f164303a 100644 --- a/drivers/video/backlight/aw99706.c +++ b/drivers/video/backlight/aw99706.c @@ -130,23 +130,23 @@ static const struct aw99706_dt_prop aw99706_dt_props[= ] =3D { AW99706_CFG0_REG, AW99706_DIM_MODE_MASK, 1, }, { - "awinic,sw-freq", aw99706_dt_property_lookup, + "awinic,sw-freq-hz", aw99706_dt_property_lookup, aw99706_sw_freq_tbl, ARRAY_SIZE(aw99706_sw_freq_tbl), AW99706_CFG1_REG, AW99706_SW_FREQ_MASK, 750000, }, { - "awinic,sw-ilmt", aw99706_dt_property_lookup, + "awinic,sw-ilmt-microamp", aw99706_dt_property_lookup, aw99706_sw_ilmt_tbl, ARRAY_SIZE(aw99706_sw_ilmt_tbl), AW99706_CFG1_REG, AW99706_SW_ILMT_MASK, 3000000, }, { - "awinic,iled-max", aw99706_dt_property_iled_max_convert, + "awinic,iled-max-microamp", aw99706_dt_property_iled_max_convert, NULL, 0, AW99706_CFG2_REG, AW99706_ILED_MAX_MASK, 20000, =20 }, { - "awinic,uvlo-thres", aw99706_dt_property_lookup, + "awinic,uvlo-thres-microvolt", aw99706_dt_property_lookup, aw99706_ulvo_thres_tbl, ARRAY_SIZE(aw99706_ulvo_thres_tbl), AW99706_CFG2_REG, AW99706_UVLOSEL_MASK, 2200000, }, --=20 2.43.0 From nobody Fri Oct 2 08:24:50 2026 Received: from out-171.mta0.migadu.com (out-171.mta0.migadu.com [91.218.175.171]) (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 25DBE430781 for ; Tue, 4 Aug 2026 04:13:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785816813; cv=none; b=flTp0YDZCpfLwa8yBTaRDgFEZeoOU0gmrxsFyHPkby5HaqkLF3UCBgoE4bdviGhWQooTmuP9JQeI+jImhyOEbZTcyCQR9hqx34J/D7QyGFrY2kwt45KrGuf/feC0y2wfXrpq3ZWu5ELE1AZgMxCDelM5beheyKTfPpB5eHUuRUU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785816813; c=relaxed/simple; bh=zOsNl7dm8Jh+c1eFsWbSZxoNtUVsVhYaAb51Cicyugk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hHkK7c+5moluxbxgdNKn91FEEv0iA74O640z1DusarZmsdtlF6nyJ603yPFd099fyIwcolG/b7iE0Z/XbWIL+HQZvm50ktVy+W4dLHp/HyUvt/TAnf8cjQXTRAjWR+8AdEZj43yre+hsK4khYAuXGhgn++7+XOgvMR1/nOt//cg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=pINP2BR6; arc=none smtp.client-ip=91.218.175.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="pINP2BR6" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1785766412; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JTAeAiLR7FZoz7bzMQxt1bZ/Rk+neEXLlOIYc9iR9Q8=; b=pINP2BR60s/h71BfJ0kzf4E01YbQfOpHBrsGUicUHfQUMCKGqwtkoqu5B+vhw0j4EjhOLx aVl1S7/ml/cuU75338oYQpXDNdf0vmLCwgeriKI+5diikUWOWpokNkBGqLhAHrXokjS0FD KKYHKCrK9bAFFc60WHb/8l9xWIF3fvQ= From: Junjie Cao To: Lee Jones , Daniel Thompson , Jingoo Han Cc: dri-devel@lists.freedesktop.org, linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Pengyu Luo Subject: [PATCH v2 2/3] backlight: aw99706: Validate all DT property values consistently Date: Mon, 3 Aug 2026 07:13:09 -0700 Message-ID: <20260803141310.1379194-3-junjie.cao@linux.dev> In-Reply-To: <20260803141310.1379194-1-junjie.cao@linux.dev> References: <20260803141310.1379194-1-junjie.cao@linux.dev> 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 X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" The lookup helpers for dim-mode and ramp-ctl take a shortcut when lookup_tbl is NULL: they accept any u32 value without range-checking and return success unconditionally. Out-of-range values get silently truncated by regmap_update_bits instead of triggering the dev_warn + default-fallback path that the other properties use. Add a field-width check for the NULL-table case so that values exceeding the register field maximum are rejected the same way a table-lookup miss is. While here, also switch the error returns to -EINVAL for consistency. Signed-off-by: Junjie Cao --- drivers/video/backlight/aw99706.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/video/backlight/aw99706.c b/drivers/video/backlight/aw= 99706.c index e130f164303a..dfb4b38b5b4c 100644 --- a/drivers/video/backlight/aw99706.c +++ b/drivers/video/backlight/aw99706.c @@ -94,6 +94,8 @@ static int aw99706_dt_property_lookup(const struct aw9970= 6_dt_prop *prop, int i; =20 if (!prop->lookup_tbl) { + if (dt_val > (prop->mask >> __ffs(prop->mask))) + return -EINVAL; *val =3D dt_val; return 0; } @@ -104,7 +106,7 @@ static int aw99706_dt_property_lookup(const struct aw99= 706_dt_prop *prop, =20 *val =3D i; =20 - return i =3D=3D prop->tbl_size ? -1 : 0; + return i =3D=3D prop->tbl_size ? -EINVAL : 0; } =20 #define MIN_ILED_MAX 5000 @@ -116,11 +118,14 @@ aw99706_dt_property_iled_max_convert(const struct aw9= 9706_dt_prop *prop, u32 dt_val, u8 *val) { if (dt_val > MAX_ILED_MAX || dt_val < MIN_ILED_MAX) - return -1; + return -EINVAL; + + if ((dt_val - MIN_ILED_MAX) % STEP_ILED_MAX) + return -EINVAL; =20 *val =3D (dt_val - MIN_ILED_MAX) / STEP_ILED_MAX; =20 - return (dt_val - MIN_ILED_MAX) % STEP_ILED_MAX; + return 0; } =20 static const struct aw99706_dt_prop aw99706_dt_props[] =3D { --=20 2.43.0 From nobody Fri Oct 2 08:24:50 2026 Received: from out-182.mta0.migadu.com (out-182.mta0.migadu.com [91.218.175.182]) (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 4CF88429CEC for ; Tue, 4 Aug 2026 04:10:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785816660; cv=none; b=lMUwgMlPNa71w0lfZaoW1VstExE6dVrJ9+QT0PX7hazncvEhgV4wlymUFWXKzAvFuDSsakjrHrIy+bPFod6Lamb1JlobAwyuZpVYZbWCBnZiUkbEBPgKAX3kYTK374VD+zldlwiQ2kcdPTX32K/wPs+uOPDQAYN3/uCH5iFB4zY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785816660; c=relaxed/simple; bh=bB+a+BsRvdyrxlR8ORveXOEKWUU2Oz0jfXPJiMmQS+U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kbhfSA6GT23XKM3/b08XjjYmy8nlnnSSp5rxYyHexG+/fm8RVGvoWwA9pJlpbM8Xe5Ou5fJE6xTUNzxqbFHJ3cYZBhzXOaLuVICHmevWvxnxk16ntkPpzcbOr58ssE0C9YysQlastLfCUzgbs0mDpNlxUlF13PI5kjDg4frb3xk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=BWG2NJhA; arc=none smtp.client-ip=91.218.175.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="BWG2NJhA" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1785766417; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nNuvHuH8fsCvdyIJJC/9rVCMMyZkr6Bz657LnndEBGA=; b=BWG2NJhA9mYQOAkIRzvnKJR/41EUlAG1gSIASEIwHRoUUrBLE0hSosrNDnV9D7SkmtjUP8 tw1iFogd3zU7Z7eFRlrvXEogNrfX/U02KOPDGp35Utfc9cC01q0zqivv0hycgiqDfZqYpn 2FJFZ9Y5Ul9hXL/rw4deh36o3UrMXog= From: Junjie Cao To: Lee Jones , Daniel Thompson , Jingoo Han Cc: dri-devel@lists.freedesktop.org, linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Pengyu Luo Subject: [PATCH v2 3/3] backlight: aw99706: Honor the core blank state in update_status() Date: Mon, 3 Aug 2026 07:13:10 -0700 Message-ID: <20260803141310.1379194-4-junjie.cao@linux.dev> In-Reply-To: <20260803141310.1379194-1-junjie.cao@linux.dev> References: <20260803141310.1379194-1-junjie.cao@linux.dev> 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 X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" update_status() passes props.brightness straight to the hardware and ignores the power/blank state tracked by the core. Writing 4 to the bl_power sysfs attribute or blanking the framebuffer therefore leaves the backlight lit. Use backlight_get_brightness(), which returns 0 while the device is blanked. Fixes: 147b38a5ad06 ("backlight: aw99706: Add support for Awinic AW99706 ba= cklight") Signed-off-by: Junjie Cao --- drivers/video/backlight/aw99706.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/backlight/aw99706.c b/drivers/video/backlight/aw= 99706.c index dfb4b38b5b4c..d035ff5af52c 100644 --- a/drivers/video/backlight/aw99706.c +++ b/drivers/video/backlight/aw99706.c @@ -340,7 +340,7 @@ static int aw99706_bl_update_status(struct backlight_de= vice *bl) { struct aw99706_device *aw =3D bl_get_data(bl); =20 - return aw99706_update_brightness(aw, bl->props.brightness); + return aw99706_update_brightness(aw, backlight_get_brightness(bl)); } =20 static const struct backlight_ops aw99706_bl_ops =3D { --=20 2.43.0