summaryrefslogtreecommitdiff
path: root/drivers/video/backlight
AgeCommit message (Collapse)Author
33 hoursMerge branch 'for-backlight-next' of ↵Mark Brown
https://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight.git
10 daysbacklight: qcom-wled: Read back the programmed brightness at probeDavid Heidelberg
Since the previous change wled_probe() seeds wled->brightness from MOD_EN, but with default-brightness rather than the level the hardware is actually driving, so a backlight left lit by the bootloader still visibly steps on the first update, and actual_brightness reports the last value written rather than what the panel shows. Add wled_read_brightness(), which returns 0 when MOD_EN is clear and otherwise reads the brightness register the matching wledN_set_brightness() writes: the first enabled string on WLED3 and WLED4, the selected modulator on WLED5. Use it to seed both wled->brightness and the initial backlight property, and expose it as backlight_ops.get_brightness so that actual_brightness reflects the hardware too. A module that is enabled with the brightness registers at zero, which wled4_setup() and wled_auto_string_detection() can leave behind on a cold boot, now reads back as off. The OVP interrupt is then armed by the first brightness update rather than from probe, which is what happens on every other board where the module starts out disabled. Suggested-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Assisted-by: LLM Signed-off-by: David Heidelberg <david@ixit.cz> Reviewed-by: Daniel Thompson (RISCstar) <danielt@kernel.org> Link: https://patch.msgid.link/20260921-qcom-wled-backlight-v4-4-bab8c7ef73cb@ixit.cz Signed-off-by: Lee Jones <lee@kernel.org>
10 daysbacklight: qcom-wled: Fix unbalanced OVP IRQ enable at probeDavid Heidelberg
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 <david@ixit.cz> Reviewed-by: Daniel Thompson (RISCstar) <danielt@kernel.org> Link: https://patch.msgid.link/20260921-qcom-wled-backlight-v4-3-bab8c7ef73cb@ixit.cz Signed-off-by: Lee Jones <lee@kernel.org>
10 daysbacklight: qcom-wled: Fix WLED3 brightness register strideDavid Heidelberg
WLED3 has a 16-bit brightness register pair per string, at 0x40 + 2*n, which is what the pm8941-wled driver wrote to: rc = regmap_bulk_write(wled->regmap, wled->addr + WLED3_CTRL_REG_VAL_BASE + 2 * i, v, 2); The restructuring for WLED3 turned that into WLED3_SINK_REG_BRIGHT(n), defined as 0x40 + n, so the two byte writes for consecutive strings overlap: string 1 overwrites the MSB of string 0 with its own LSB, and with the default three strings only string 1 ends up with the requested value. Use the 2 byte stride. Fixes: 775d2ffb4af6 ("backlight: qcom-wled: Restructure the driver for WLED3") Cc: stable@vger.kernel.org Assisted-by: LLM Signed-off-by: David Heidelberg <david@ixit.cz> Reviewed-by: Daniel Thompson (RISCstar) <danielt@kernel.org> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Link: https://patch.msgid.link/20260921-qcom-wled-backlight-v4-2-bab8c7ef73cb@ixit.cz Signed-off-by: Lee Jones <lee@kernel.org>
10 daysbacklight: qcom-wled: Fix NULL pointer dereference in wled_remove()David Heidelberg
wled_probe() doesn't set the driver data for the platform device. As a result, platform_get_drvdata() in wled_remove() will return NULL, and the first dereference of it crashes on unbind. Set the platform device driver data in wled_probe(). Cc: stable@vger.kernel.org Fixes: feeab87b3072 ("backlight: qcom-wled: Add support for short circuit handling") Signed-off-by: David Heidelberg <david@ixit.cz> Reviewed-by: Daniel Thompson (RISCstar) <danielt@kernel.org> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Link: https://patch.msgid.link/20260921-qcom-wled-backlight-v4-1-bab8c7ef73cb@ixit.cz Signed-off-by: Lee Jones <lee@kernel.org>
10 daysbacklight: lm3630a: Cancel delayed work before destroying workqueueMyeonghun Pak
The interrupt handler queues delayed work to read the interrupt status. After free_irq() stops the producer, this work can still be waiting on its timer. destroy_workqueue() cannot drain delayed work that has not yet been queued by its timer, so the timer can outlive both the workqueue and the devm-allocated chip containing the work. Cancel the delayed work synchronously after freeing the IRQ and before destroying the workqueue. This also waits for any running status read to finish before the chip's resources are released. This issue was identified during our ongoing static-analysis research while reviewing kernel code. Fixes: 0c2a665a648e ("backlight: add Backlight driver for lm3630 chip") Cc: stable@vger.kernel.org Assisted-by: LLM Co-developed-by: Ijae Kim <ae878000@gmail.com> Signed-off-by: Ijae Kim <ae878000@gmail.com> Signed-off-by: Myeonghun Pak <mhun512@gmail.com> Reviewed-by: Daniel Thompson (RISCstar) <danielt@kernel.org> Link: https://patch.msgid.link/20261003030439.599330-1-mhun512@gmail.com Signed-off-by: Lee Jones <lee@kernel.org>
2026-09-16backlight: ili9320/ktd253: Fix typos in commentsHemanth Selam
Fix typos in comments, reported by scripts/checkpatch.pl using the misspelling list in scripts/spelling.txt. Only touches comments, no code changes. Assisted-by: Cursor:claude-opus-5 Signed-off-by: Hemanth Selam <hemanth.selam@gmail.com> Link: https://patch.msgid.link/20260904122646.32558-1-hemanth.selam@gmail.com Signed-off-by: Lee Jones <lee@kernel.org>
2026-09-10video: backlight: lm3533_bl: Implement backlight_scale propertySvyatoslav Ryhel
Since the device supports linear and non-linear modes, implement the backlight_scale property to describe this state. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Reviewed-by: Daniel Thompson (RISCstar) <danielt@kernel.org> Link: https://patch.msgid.link/20260731113632.158440-14-clamor95@gmail.com Signed-off-by: Lee Jones <lee@kernel.org>
2026-09-10video: backlight: lm3533_bl: Set initial mapping mode from DTSvyatoslav Ryhel
Add support to obtain the initial mapping mode from DT instead of leaving it unconfigured. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Reviewed-by: Daniel Thompson (RISCstar) <danielt@kernel.org> Link: https://patch.msgid.link/20260731113632.158440-13-clamor95@gmail.com Signed-off-by: Lee Jones <lee@kernel.org>
2026-09-10video: backlight: lm3533_bl: Improve logic of sysfs functionsSvyatoslav Ryhel
Simplify the sysfs logic of properties by switching to macros and proper regmap helpers. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Reviewed-by: Daniel Thompson (RISCstar) <danielt@kernel.org> Link: https://patch.msgid.link/20260731113632.158440-12-clamor95@gmail.com Signed-off-by: Lee Jones <lee@kernel.org>
2026-09-10mfd: lm3533: Convert to use OF bindingsSvyatoslav Ryhel
Since there are no users of this driver via platform data, remove the platform data support and switch to using Device Tree bindings. Previously, all cell devices were linked to the parent device. This could cause problems further down the line because the LM3533 has multiple cells of the same type. Using a single phandle to the parent could cause confusion when attempting to reference or call the correct child node. Since this commit adds a dedicated node for every cell, remove linking of the cell to the parent node. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Reviewed-by: Daniel Thompson (RISCstar) <danielt@kernel.org> #for backlight Acked-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com> #for-iio Link: https://patch.msgid.link/20260731113632.158440-9-clamor95@gmail.com Signed-off-by: Lee Jones <lee@kernel.org>
2026-09-10mfd: lm3533: Use dev_groups in struct device_driverSvyatoslav Ryhel
Instead of creating and removing the device sysfs attributes directly during probe and remove of the driver, respectively, use dev_groups in struct device_driver to point to the attribute definitions and let the core take care of creating and removing them. No intentional functional impact. Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Reviewed-by: Johan Hovold <johan@kernel.org> Link: https://patch.msgid.link/20260731113632.158440-8-clamor95@gmail.com Signed-off-by: Lee Jones <lee@kernel.org>
2026-09-10mfd: lm3533: Pass only regmap and light sensor presence to child devicesSvyatoslav Ryhel
Instead of passing the entire lm3533 core data structure, only pass the regmap and the light sensor presence flag to child devices. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Acked-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com> #for-iio Link: https://patch.msgid.link/20260731113632.158440-5-clamor95@gmail.com Signed-off-by: Lee Jones <lee@kernel.org>
2026-09-10mfd: lm3533: Remove driver specific regmap wrappersSvyatoslav Ryhel
Remove driver-specific regmap wrappers in favor of using regmap helpers directly. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Acked-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com> Link: https://patch.msgid.link/20260731113632.158440-3-clamor95@gmail.com Signed-off-by: Lee Jones <lee@kernel.org>
2026-08-27Merge tag 'backlight-next-7.3' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight Pull backlight updates from Lee Jones: "New Support & Features: - Silergy SY7758: Add driver for the 6-channel high-efficiency LED driver Improvements & Fixes - Awinic AW99706: Fix device tree property names to match the binding, consistently validate all property values, and honor the core blank state in `update_status()` - Kinetic KTD2801: Add missing dependency on `GPIOLIB` in Kconfig - Qualcomm WLED: Remove redundant `dev_err()` calls Cleanups & Refactoring - Core: Use `sysfs_emit()` instead of `sprintf()` in sysfs show callbacks - Maintainers: Update Junjie Cao's email address for the Awinic AW99706 driver Device Tree Binding Updates - Marvell 88PM860X: Add missing bracket in the example - Silergy SY7758: Document the 6-channel high-efficiency LED driver" * tag 'backlight-next-7.3' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight: backlight: Use sysfs_emit() instead of sprintf() backlight: qcom-wled: Remove redundant dev_err() backlight: ktd2801: Fix unmet dependency on GPIOLIB backlight: aw99706: Honor the core blank state in update_status() backlight: aw99706: Validate all DT property values consistently backlight: aw99706: Fix DT property names to match binding dt-bindings: backlight: 88pm860x: Add missing bracket MAINTAINERS: Update my email address for the AW99706 backlight driver backlight: Add SY7758 6-channel High Efficiency LED Driver support dt-bindings: leds: backlight: Document the SY7758 6-channel High Efficiency LED Driver
2026-08-12backlight: Use sysfs_emit() instead of sprintf()Levente Szajko
Replace sprintf() with sysfs_emit() in the sysfs show callbacks of backlight.c and lcd.c, as recommended by Documentation/filesystems/sysfs.rst. No functional change intended. Signed-off-by: Levente Szajko <raedrimhun@proton.me> Reviewed-by: Daniel Thompson (RISCstar) <danielt@kernel.org> Link: https://patch.msgid.link/20260805135027.43890-1-raedrimhun@proton.me Signed-off-by: Lee Jones <lee@kernel.org>
2026-08-12backlight: qcom-wled: Remove redundant dev_err()Pan Chuang
Since commit 55b48e23f5c4 ("genirq/devres: Add error handling in devm_request_*_irq()"), devm_request_threaded_irq() automatically logs detailed error messages on failure. Remove the now-redundant driver-specific dev_err() calls. Signed-off-by: Pan Chuang <panchuang@vivo.com> Reviewed-by: Daniel Thompson (RISCstar) <danielt@kernel.org> Link: https://patch.msgid.link/20260722065709.346072-1-panchuang@vivo.com Signed-off-by: Lee Jones <lee@kernel.org>
2026-08-12backlight: ktd2801: Fix unmet dependency on GPIOLIBJulian Braha
LEDS_EXPRESSWIRE depends on GPIOLIB, so its selector, BACKLIGHT_KTD2801 also needs to ensure GPIOLIB is enabled. Otherwise: WARNING: unmet direct dependencies detected for LEDS_EXPRESSWIRE Depends on [n]: NEW_LEDS [=n] && GPIOLIB [=n] Selected by [y]: - BACKLIGHT_KTD2801 [=y] && HAS_IOMEM [=y] && BACKLIGHT_CLASS_DEVICE [=y] This unmet dependency was found by kconfirm, a static analysis tool for Kconfig. Fixes: d95963e309bc ("backlight: ktd2801: Depend on GPIOLIB") Signed-off-by: Julian Braha <julianbraha@gmail.com> Reviewed-by: Daniel Thompson (RISCstar) <danielt@kernel.org> Acked-by: Duje Mihanović <duje@dujemihanovic.xyz> Tested-by: Randy Dunlap <rdunlap@infradead.org> Acked-by: Randy Dunlap <rdunlap@infradead.org> Link: https://patch.msgid.link/20260719024902.151710-1-julianbraha@gmail.com Signed-off-by: Lee Jones <lee@kernel.org>
2026-08-12backlight: aw99706: Honor the core blank state in update_status()Junjie Cao
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 backlight") Cc: stable@vger.kernel.org Signed-off-by: Junjie Cao <junjie.cao@linux.dev> Reviewed-by: Daniel Thompson (RISCstar) <danielt@kernel.org> Link: https://patch.msgid.link/20260804030255.1934470-4-junjie.cao@intel.com Signed-off-by: Lee Jones <lee@kernel.org>
2026-08-12backlight: aw99706: Validate all DT property values consistentlyJunjie Cao
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. The switching frequency table has a second hole: reserved slots use 0 as their marker, so "awinic,sw-freq-hz = <0>" matches slot 0 and programs a reserved encoding. Make the reserved marker U32_MAX and skip such slots during lookup. While here, also switch the error returns to -EINVAL for consistency. Fixes: 147b38a5ad06 ("backlight: aw99706: Add support for Awinic AW99706 backlight") Signed-off-by: Junjie Cao <junjie.cao@linux.dev> Reviewed-by: Daniel Thompson (RISCstar) <danielt@kernel.org> Link: https://patch.msgid.link/20260804030255.1934470-3-junjie.cao@intel.com Signed-off-by: Lee Jones <lee@kernel.org>
2026-08-12backlight: aw99706: Fix DT property names to match bindingJunjie Cao
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 backlight") Cc: stable@vger.kernel.org Signed-off-by: Junjie Cao <junjie.cao@linux.dev> Reviewed-by: Daniel Thompson (RISCstar) <danielt@kernel.org> Link: https://patch.msgid.link/20260804030255.1934470-2-junjie.cao@intel.com Signed-off-by: Lee Jones <lee@kernel.org>
2026-07-03Replace <linux/mod_devicetable.h> by more specific <linux/device-id/*.h> (c ↵Uwe Kleine-König (The Capable Hub)
files) Replace the #include of <linux/mod_devicetable.h> by the more specific <linux/device-id/*.h> where applicable. For most cases the include can be dropped completely, only a few drivers need one or two headers added. Acked-by: Danilo Krummrich <dakr@kernel.org> Acked-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Acked-by: Bjorn Helgaas <bhelgaas@google.com> Link: https://patch.msgid.link/1a3f2007c5c5dcf555c09a4035ce3ae8ef1b6c49.1782808461.git.u.kleine-koenig@baylibre.com Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
2026-07-02backlight: Add SY7758 6-channel High Efficiency LED Driver supportKancyJoe
Implement support for the Silergy SY7758 6-channel High Efficiency LED Driver used for backlight brightness control in the Ayaneo Pocket S2 dual-DSI panel. Signed-off-by: KancyJoe <kancy2333@outlook.com> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> Reviewed-by: Daniel Thompson (RISCstar) <danielt@kernel.org> Link: https://patch.msgid.link/20260529-topic-sm8650-ayaneo-pocket-s2-sy7758-v5-2-03aacd49747c@linaro.org Signed-off-by: Lee Jones <lee@kernel.org>
2026-06-11backlight: Use named initializers for arrays of i2c_device_dataUwe Kleine-König (The Capable Hub)
While being less compact, using named initializers allows to more easily see which members of the structs are assigned which value without having to lookup the declaration of the struct. And it's also more robust against changes to the struct definition. The mentioned robustness is relevant for a planned change to struct i2c_device_id that replaces .driver_data by an anonymous union. While touching all these arrays, unify usage of whitespace in the list terminator. This patch doesn't modify the compiled arrays, only their representation in source form benefits. The former was confirmed with x86 and arm64 builds. Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> Reviewed-by: Daniel Thompson (RISCstar) <danielt@kernel.org> Link: https://patch.msgid.link/20260518111203.639603-2-u.kleine-koenig@baylibre.com Signed-off-by: Lee Jones <lee@kernel.org>
2026-05-07backlight: cgbc: Remove redundant X86 dependencyThomas Richard
The backlight driver depends on the MFD cgbc-core driver, which already depends on X86. The explicit X86 dependency for the backlight driver is redundant and can be safely removed. Signed-off-by: Thomas Richard <thomas.richard@bootlin.com> Reviewed-by: Daniel Thompson (RISCstar) <danielt@kernel.org> Link: https://patch.msgid.link/20260427-backlight-cgbc-remove-x86-dependency-v2-1-da9f2375a34a@bootlin.com Signed-off-by: Lee Jones <lee@kernel.org>
2026-04-30backlight: Add max25014atg backlightMaud Spierings
The Maxim MAX25014 is a 4-channel automotive grade backlight driver IC with integrated boost controller. Signed-off-by: Maud Spierings <maudspierings@gocontroll.com> Reviewed-by: Daniel Thompson (RISCstar) <danielt@kernel.org> Link: https://patch.msgid.link/20260407-max25014-v8-2-14eac7ed673a@gocontroll.com Signed-off-by: Lee Jones <lee@kernel.org>
2026-04-30backlight: ktd2801: Enable BL_CORE_SUSPENDRESUMEDuje Mihanović
Boards using this backlight chip do not power the backlight off on suspend. Enable BL_CORE_SUSPENDRESUME so the chip gets powered off by the backlight core on suspend. Tested on samsung,coreprimevelte. Cc: stable@vger.kernel.org # v6.19 Signed-off-by: Duje Mihanović <duje@dujemihanovic.xyz> Reviewed-by: Daniel Thompson (RISCstar) <danielt@kernel.org> Link: https://patch.msgid.link/20260328-ktd2801-pm-fix-v1-1-007cb103faeb@dujemihanovic.xyz Signed-off-by: Lee Jones <lee@kernel.org>
2026-03-31backlight: apple_bl: Convert to a platform driverRafael J. Wysocki
In all cases in which a struct acpi_driver is used for binding a driver to an ACPI device object, a corresponding platform device is created by the ACPI core and that device is regarded as a proper representation of underlying hardware. Accordingly, a struct platform_driver should be used by driver code to bind to that device. There are multiple reasons why drivers should not bind directly to ACPI device objects [1]. Overall, it is better to bind drivers to platform devices than to their ACPI companions, so convert the Apple Backlight ACPI driver to a platform one. While this is not expected to alter functionality, it changes sysfs layout and so it will be visible to user space. Link: https://lore.kernel.org/all/2396510.ElGaqSPkdT@rafael.j.wysocki/ [1] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Daniel Thompson (RISCstar) <danielt@kernel.org> Link: https://patch.msgid.link/5084777.GXAFRqVoOG@rafael.j.wysocki Signed-off-by: Lee Jones <lee@kernel.org>
2026-03-06backlight: sky81452-backlight: Check return value of ↵Chen Ni
devm_gpiod_get_optional() in sky81452_bl_parse_dt() The devm_gpiod_get_optional() function may return an ERR_PTR in case of genuine GPIO acquisition errors, not just NULL which indicates the legitimate absence of an optional GPIO. Add an IS_ERR() check after the call in sky81452_bl_parse_dt(). On error, return the error code to ensure proper failure handling rather than proceeding with invalid pointers. Fixes: e1915eec54a6 ("backlight: sky81452: Convert to GPIO descriptors") Signed-off-by: Chen Ni <nichen@iscas.ac.cn> Reviewed-by: Linus Walleij <linusw@kernel.org> Reviewed-by: Daniel Thompson (RISCstar) <danielt@kernel.org> Link: https://patch.msgid.link/20260203021625.578678-1-nichen@iscas.ac.cn Signed-off-by: Lee Jones <lee@kernel.org>
2026-02-21Convert 'alloc_obj' family to use the new default GFP_KERNEL argumentLinus Torvalds
This was done entirely with mindless brute force, using git grep -l '\<k[vmz]*alloc_objs*(.*, GFP_KERNEL)' | xargs sed -i 's/\(alloc_objs*(.*\), GFP_KERNEL)/\1)/' to convert the new alloc_obj() users that had a simple GFP_KERNEL argument to just drop that argument. Note that due to the extreme simplicity of the scripting, any slightly more complex cases spread over multiple lines would not be triggered: they definitely exist, but this covers the vast bulk of the cases, and the resulting diff is also then easier to check automatically. For the same reason the 'flex' versions will be done as a separate conversion. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2026-02-21treewide: Replace kmalloc with kmalloc_obj for non-scalar typesKees Cook
This is the result of running the Coccinelle script from scripts/coccinelle/api/kmalloc_objs.cocci. The script is designed to avoid scalar types (which need careful case-by-case checking), and instead replace kmalloc-family calls that allocate struct or union object instances: Single allocations: kmalloc(sizeof(TYPE), ...) are replaced with: kmalloc_obj(TYPE, ...) Array allocations: kmalloc_array(COUNT, sizeof(TYPE), ...) are replaced with: kmalloc_objs(TYPE, COUNT, ...) Flex array allocations: kmalloc(struct_size(PTR, FAM, COUNT), ...) are replaced with: kmalloc_flex(*PTR, FAM, COUNT, ...) (where TYPE may also be *VAR) The resulting allocations no longer return "void *", instead returning "TYPE *". Signed-off-by: Kees Cook <kees@kernel.org>
2026-02-04backlight: qcom-wled: Change PM8950 WLED configurationsBarnabás Czémán
PMI8950 WLED needs same configurations as PMI8994 WLED. Fixes: 10258bf4534b ("backlight: qcom-wled: Add PMI8950 compatible") Signed-off-by: Barnabás Czémán <barnabas.czeman@mainlining.org> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Reviewed-by: Daniel Thompson (RISCstar) <danielt@kernel.org> Link: https://patch.msgid.link/20260116-pmi8950-wled-v3-4-e6c93de84079@mainlining.org Signed-off-by: Lee Jones <lee@kernel.org>
2026-02-04backlight: qcom-wled: Support ovp values for PMI8994Barnabás Czémán
WLED4 found in PMI8994 supports different ovp values. Fixes: 6fc632d3e3e0 ("video: backlight: qcom-wled: Add PMI8994 compatible") Signed-off-by: Barnabás Czémán <barnabas.czeman@mainlining.org> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Reviewed-by: Daniel Thompson (RISCstar) <danielt@kernel.org> Link: https://patch.msgid.link/20260116-pmi8950-wled-v3-2-e6c93de84079@mainlining.org Signed-off-by: Lee Jones <lee@kernel.org>
2026-01-20backlight: aw99706: Fix build errors caused by wrong gpio headerJunjie Cao
The driver uses GPIO descriptor API (devm_gpiod_get, gpiod_set_value_cansleep, GPIOD_OUT_LOW) but includes the legacy <linux/gpio.h> header instead of <linux/gpio/consumer.h>. When CONFIG_GPIOLIB is not set, <linux/gpio.h> does not include <linux/gpio/consumer.h>, causing build errors: error: implicit declaration of function 'gpiod_set_value_cansleep' error: implicit declaration of function 'devm_gpiod_get' error: 'GPIOD_OUT_LOW' undeclared Fix by including the correct header <linux/gpio/consumer.h>. Fixes: 147b38a5ad06 ("backlight: aw99706: Add support for Awinic AW99706 backlight") Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202512171631.uKXlYwqu-lkp@intel.com/ Signed-off-by: Junjie Cao <junjie.cao@intel.com> Reviewed-by: Daniel Thompson (RISCstar) <danielt@kernel.org> Link: https://patch.msgid.link/20260111130117.5041-1-junjie.cao@intel.com Signed-off-by: Lee Jones <lee@kernel.org>
2026-01-08backlight: Add Congatec Board Controller (CGBC) backlight supportPetri Karhula
This driver provides backlight brightness control through the Linux backlight subsystem. It communicates with the board controller to adjust LCD backlight using PWM signals. Communication is done through Congatec Board Controller core driver. Tested-by: Thomas Richard <thomas.richard@bootlin.com> Reviewed-by: Thomas Richard <thomas.richard@bootlin.com> Reviewed-by: Daniel Thompson (RISCstar) <danielt@kernel.org> Signed-off-by: Petri Karhula <petri.karhula@novatron.fi> Link: https://patch.msgid.link/20251205-cgbc-backlight-v6-1-e4175b0bf406@novatron.fi Signed-off-by: Lee Jones <lee@kernel.org>
2025-11-27backlight: aw99706: Fix unused function warnings from suspend/resume opsNathan Chancellor
When building for a platform without CONFIG_PM_SLEEP, such as s390, there are two unused function warnings: drivers/video/backlight/aw99706.c:436:12: error: 'aw99706_resume' defined but not used [-Werror=unused-function] 436 | static int aw99706_resume(struct device *dev) | ^~~~~~~~~~~~~~ drivers/video/backlight/aw99706.c:429:12: error: 'aw99706_suspend' defined but not used [-Werror=unused-function] 429 | static int aw99706_suspend(struct device *dev) | ^~~~~~~~~~~~~~~ SET_SYSTEM_SLEEP_PM_OPS, used within SIMPLE_DEV_PM_OPS, expands to nothing when CONFIG_PM_SLEEP is not set, so these functions are completely unused in this configuration. SIMPLE_DEV_PM_OPS is deprecated in favor of DEFINE_SIMPLE_DEV_PM_OPS, which avoids this issue by using pm_sleep_ptr to make these callbacks NULL when CONFIG_PM_SLEEP is unset while making the callback functions always appear used to the compiler regardless of configuration. Switch to DEFINE_SIMPLE_DEV_PM_OPS for aw99706_pm_ops to clear up the warning. Additionally, wrap the pointer to aw99706_pm_ops in pm_ptr() in aw99706_i2c_driver to ensure that the structure is completely eliminated in configurations without CONFIG_PM. Fixes: 88a8e9b49ee8 ("backlight: aw99706: Add support for Awinic AW99706 backlight") Signed-off-by: Nathan Chancellor <nathan@kernel.org> Link: https://patch.msgid.link/20251120-backlight-aw99706-fix-unused-pm-functions-v1-1-8b9c17c4e783@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
2025-11-25backlight: aw99706: Add support for Awinic AW99706 backlightJunjie Cao
Add support for Awinic AW99706 backlight, which can be found in tablet and notebook backlight, one case is the Lenovo Legion Y700 Gen4. This driver refers to the official datasheets and android driver, they can be found in [1]. [1] https://www.awinic.com/en/productDetail/AW99706QNR Signed-off-by: Junjie Cao <caojunjie650@gmail.com> Tested-by: Pengyu Luo <mitltlatltl@gmail.com> Signed-off-by: Pengyu Luo <mitltlatltl@gmail.com> Reviewed-by: Daniel Thompson (RISCstar) <danielt@kernel.org> Link: https://patch.msgid.link/20251109032240.3422503-3-caojunjie650@gmail.com Signed-off-by: Lee Jones <lee@kernel.org>
2025-11-25backlight: led-bl: Add devlink to supplier LEDsLuca Ceresoli
LED Backlight is a consumer of one or multiple LED class devices, but devlink is currently unable to create correct supplier-producer links when the supplier is a class device. It creates instead a link where the supplier is the parent of the expected device. One consequence is that removal order is not correctly enforced. Issues happen for example with the following sections in a device tree overlay: // An LED driver chip pca9632@62 { compatible = "nxp,pca9632"; reg = <0x62>; // ... addon_led_pwm: led-pwm@3 { reg = <3>; label = "addon:led:pwm"; }; }; backlight-addon { compatible = "led-backlight"; leds = <&addon_led_pwm>; brightness-levels = <255>; default-brightness-level = <255>; }; In this example, the devlink should be created between the backlight-addon (consumer) and the pca9632@62 (supplier). Instead it is created between the backlight-addon (consumer) and the parent of the pca9632@62, which is typically the I2C bus adapter. On removal of the above overlay, the LED driver can be removed before the backlight device, resulting in: Unable to handle kernel NULL pointer dereference at virtual address 0000000000000010 ... Call trace: led_put+0xe0/0x140 devm_led_release+0x6c/0x98 Another way to reproduce the bug without any device tree overlays is unbinding the LED class device (pca9632@62) before unbinding the consumer (backlight-addon): echo 11-0062 >/sys/bus/i2c/drivers/leds-pca963x/unbind echo ...backlight-dock >/sys/bus/platform/drivers/led-backlight/unbind Fix by adding a devlink between the consuming led-backlight device and the supplying LED device, as other drivers and subsystems do as well. Fixes: ae232e45acf9 ("backlight: add led-backlight driver") Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Reviewed-by: Daniel Thompson (RISCstar) <danielt@kernel.org> Reviewed-by: Herve Codina <herve.codina@bootlin.com> Tested-by: Alexander Sverdlin <alexander.sverdlin@siemens.com> Link: https://patch.msgid.link/20250519-led-backlight-add-devlink-to-supplier-class-device-v6-1-845224aeb2ce@bootlin.com Signed-off-by: Lee Jones <lee@kernel.org>
2025-11-06backlight: ktd2801: Depend on GPIOLIBDuje Mihanović
The LEDS_EXPRESSWIRE library used by the driver requires GPIOLIB. Make sure this dependency is not left unsatisfied. Reported-by: Randy Dunlap <rdunlap@infradead.org> Closes: https://lore.kernel.org/all/b6c481bb-e854-405e-a428-90301789fe20@infradead.org/ Signed-off-by: Duje Mihanović <duje@dujemihanovic.xyz> Reviewed-by: Daniel Thompson (RISCstar) <danielt@kernel.org> Reviewed-by: Randy Dunlap <rdunlap@infradead.org> Tested-by: Randy Dunlap <rdunlap@infradead.org> Acked-by: Randy Dunlap <rdunlap@infradead.org> Link: https://patch.msgid.link/20250729-expresswire-dep-fix-v1-2-635cd4cc746b@dujemihanovic.xyz Signed-off-by: Lee Jones <lee@kernel.org>
2025-09-16backlight: rt4831: Include <linux/mod_devicetable.h>Thomas Zimmermann
Include <linux/mod_devicetable.h> to declare struct of_device_id. Avoids dependency on backlight header to include it. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: "Daniel Thompson (RISCstar)" <danielt@kernel.org> Link: https://lore.kernel.org/r/20250715122643.137027-15-tzimmermann@suse.de Signed-off-by: Lee Jones <lee@kernel.org>
2025-09-16backlight: rave-sp: Include <linux/of.h> and <linux/mod_devicetable.h>Thomas Zimmermann
Include <linux/of.h> to declare struct device_node and include <linux/mod_devicetable.h> to declare struct of_device_id. Avoids dependency on backlight header to include it. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: "Daniel Thompson (RISCstar)" <danielt@kernel.org> Link: https://lore.kernel.org/r/20250715122643.137027-14-tzimmermann@suse.de Signed-off-by: Lee Jones <lee@kernel.org>
2025-09-16backlight: led_bl: Include <linux/of.h>Thomas Zimmermann
Include <linux/of.h> to declare struct of_count_phandle_with_args(). Avoids dependency on backlight header to include it. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: "Daniel Thompson (RISCstar)" <danielt@kernel.org> Link: https://lore.kernel.org/r/20250715122643.137027-13-tzimmermann@suse.de Signed-off-by: Lee Jones <lee@kernel.org>
2025-09-16backlight: ktd2801: Include <linux/mod_devicetable.h>Thomas Zimmermann
Include <linux/mod_devicetable.h> to declare struct of_device_id. Avoids dependency on backlight header to include it. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Nick Chan <towinchenmi@gmail.com> Reviewed-by: "Daniel Thompson (RISCstar)" <danielt@kernel.org> Acked-by: Duje Mihanović <duje.mihanovic@skole.hr> Link: https://lore.kernel.org/r/20250715122643.137027-12-tzimmermann@suse.de Signed-off-by: Lee Jones <lee@kernel.org>
2025-09-16backlight: jornada720: Include <linux/io.h>Thomas Zimmermann
Include <linux/io.h> to declare IOMEM(). Avoids dependency on backlight header to include it. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: "Daniel Thompson (RISCstar)" <danielt@kernel.org> Link: https://lore.kernel.org/r/20250715122643.137027-11-tzimmermann@suse.de Signed-off-by: Lee Jones <lee@kernel.org>
2025-09-16backlight: da9052_bl: Include <linux/mod_devicetable.h>Thomas Zimmermann
Include <linux/mod_devicetable.h> to declare struct platform_device_id. Avoids dependency on backlight header to include it. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: "Daniel Thompson (RISCstar)" <danielt@kernel.org> Link: https://lore.kernel.org/r/20250715122643.137027-10-tzimmermann@suse.de Signed-off-by: Lee Jones <lee@kernel.org>
2025-09-16backlight: as3711_bl: Include <linux/of.h>Thomas Zimmermann
Include <linux/of.h> to declare various OF helpers. Avoids dependency on backlight header to include it. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: "Daniel Thompson (RISCstar)" <danielt@kernel.org> Link: https://lore.kernel.org/r/20250715122643.137027-9-tzimmermann@suse.de Signed-off-by: Lee Jones <lee@kernel.org>
2025-09-16backlight: apple_dwi_bl: Include <linux/mod_devicetable.h>Thomas Zimmermann
Include <linux/mod_devicetable.h> to declare struct of_device_id. Avoids dependency on backlight header to include it. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Nick Chan <towinchenmi@gmail.com> Reviewed-by: "Daniel Thompson (RISCstar)" <danielt@kernel.org> Link: https://lore.kernel.org/r/20250715122643.137027-8-tzimmermann@suse.de Signed-off-by: Lee Jones <lee@kernel.org>
2025-09-16backlight: Include <linux/of.h>Thomas Zimmermann
Include <linux/of.h> to avoid dependency on backlight header to include it. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: "Daniel Thompson (RISCstar)" <danielt@kernel.org> Link: https://lore.kernel.org/r/20250715122643.137027-7-tzimmermann@suse.de Signed-off-by: Lee Jones <lee@kernel.org>
2025-09-16video: backlight: lp855x_bl: Set correct EPROM start for LP8556Svyatoslav Ryhel
According to LP8556 datasheet EPROM region starts at 0x98 so adjust value in the driver accordingly. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Reviewed-by: "Daniel Thompson (RISCstar)" <danielt@kernel.org> Link: https://lore.kernel.org/r/20250909074304.92135-2-clamor95@gmail.com Signed-off-by: Lee Jones <lee@kernel.org>
2025-09-16backlight: led_bl: Use devm_kcalloc() for array space allocationQianfeng Rong
Replace calls of devm_kzalloc() with devm_kcalloc() in led_bl_get_leds() and led_bl_parse_levels() for safer memory allocation with built-in overflow protection. Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com> Reviewed-by: "Daniel Thompson (RISCstar)" <danielt@kernel.org> Link: https://lore.kernel.org/r/20250819035804.433615-1-rongqianfeng@vivo.com Signed-off-by: Lee Jones <lee@kernel.org>