summaryrefslogtreecommitdiff
path: root/drivers/video/backlight
AgeCommit message (Collapse)AuthorFilesLines
2024-05-10backlight: sky81452-backlight: Remove unnecessary call to of_node_get()Shresth Prasad1-6/+2
`dev->of_node` already has a reference to the device_node and calling of_node_get on it is unnecessary. All conresponding calls to of_node_put are also removed. Signed-off-by: Shresth Prasad <shresthprasad7@gmail.com> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240502172121.8695-2-shresthprasad7@gmail.com Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-10backlight: mp3309c: Fix LEDs flickering in PWM modeFlavio Suligoi1-5/+0
The mp3309 has two configuration registers, named according to their address (0x00 and 0x01). In the second register (0x01), the bit DIMS (Dimming Mode Select) must be always 0 (zero), in both analog (via I2C commands) and PWM dimming mode. In the initial driver version, the DIMS bit was set in PWM mode and reset in analog mode. But if the DIMS bit is set in pwm dimming mode and other devices are connected on the same I2C bus, every I2C commands on the bus generates a flickering on the LEDs powered by the mp3309c. This change concerns the chip initialization and does not impact any existing device-tree configuration. Signed-off-by: Flavio Suligoi <f.suligoi@asem.it> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240417153105.1794134-2-f.suligoi@asem.it Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-10backlight: otm3225a: Drop driver owner assignmentKrzysztof Kozlowski1-1/+0
Core in spi_register_driver() already sets the .owner, so driver does not need to. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240327174714.519577-1-krzysztof.kozlowski@linaro.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-10backlight: lp8788: Drop support for platform dataUwe Kleine-König1-143/+8
The backlight driver supports getting passed platform data. However this isn't used. This allows to remove quite some dead code from the driver because bl->pdata is always NULL, and so bl->mode is always LP8788_BL_REGISTER_ONLY. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240329133839.550065-2-u.kleine-koenig@pengutronix.de Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-10backlight: lcd: Make lcd_class constantRicardo B. Marliere1-10/+13
Since commit 43a7206b0963 ("driver core: class: make class_register() take a const *"), the driver core allows for struct class to be in read-only memory, so move the lcd_class structure to be declared at build time placing it into read-only memory, instead of having to be dynamically allocated at boot time. Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/2024032809-enchanted-conducive-3677@gregkh Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-10backlight: Make backlight_class constantRicardo B. Marliere1-13/+16
Since commit 43a7206b0963 ("driver core: class: make class_register() take a const *"), the driver core allows for struct class to be in read-only memory, so move the backlight_class structure to be declared at build time placing it into read-only memory, instead of having to be dynamically allocated at boot time. Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240305-class_cleanup-backlight-v1-1-c0e15cc25be1@marliere.net Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-10backlight: mp3309c: Fix signedness bug in mp3309c_parse_fwnode()Dan Carpenter1-1/+2
The "num_levels" variable is used to store error codes from device_property_count_u32() so it needs to be signed. This doesn't cause an issue at runtime because devm_kcalloc() won't allocate negative sizes. However, it's still worth fixing. Fixes: b54c828bdba9 ("backlight: mp3309c: Make use of device properties") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Tested-by: Flavio Suligoi <f.suligoi@asem.it> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/74347f67-360d-4513-8939-595e3c4764fa@moroto.mountain Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-10Merge branches 'ib-backlight-auxdisplay-staging-omap-6.9', ↵Lee Jones20-54/+39
'ib-backlight-auxdisplay-hid-fb-6.9' and 'ib-backlight-hid-fbdev-lcd-scripts-6.10' into ibs-for-backlight-merged
2024-05-03backlight: tdo24m: Constify lcd_opsKrzysztof Kozlowski1-1/+1
'struct lcd_ops' is not modified by core backlight code, so it can be made const for increased code safety. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240424-video-backlight-lcd-ops-v2-14-1aaa82b07bc6@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-03backlight: platform_lcd: Constify lcd_opsKrzysztof Kozlowski1-1/+1
'struct lcd_ops' is not modified by core backlight code, so it can be made const for increased code safety. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240424-video-backlight-lcd-ops-v2-13-1aaa82b07bc6@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-03backlight: otm3225a: Constify lcd_opsKrzysztof Kozlowski1-1/+1
'struct lcd_ops' is not modified by core backlight code, so it can be made const for increased code safety. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240424-video-backlight-lcd-ops-v2-12-1aaa82b07bc6@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-03backlight: ltv350qv: Constify lcd_opsKrzysztof Kozlowski1-1/+1
'struct lcd_ops' is not modified by core backlight code, so it can be made const for increased code safety. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240424-video-backlight-lcd-ops-v2-11-1aaa82b07bc6@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-03backlight: lms501kf03: Constify lcd_opsKrzysztof Kozlowski1-1/+1
'struct lcd_ops' is not modified by core backlight code, so it can be made const for increased code safety. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240424-video-backlight-lcd-ops-v2-10-1aaa82b07bc6@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-03backlight: lms283gf05: Constify lcd_opsKrzysztof Kozlowski1-1/+1
'struct lcd_ops' is not modified by core backlight code, so it can be made const for increased code safety. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240424-video-backlight-lcd-ops-v2-9-1aaa82b07bc6@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-03backlight: l4f00242t03: Constify lcd_opsKrzysztof Kozlowski1-1/+1
'struct lcd_ops' is not modified by core backlight code, so it can be made const for increased code safety. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240424-video-backlight-lcd-ops-v2-8-1aaa82b07bc6@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-03backlight: jornada720_lcd: Constify lcd_opsKrzysztof Kozlowski1-1/+1
'struct lcd_ops' is not modified by core backlight code, so it can be made const for increased code safety. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240424-video-backlight-lcd-ops-v2-7-1aaa82b07bc6@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-03backlight: ili9320: Constify lcd_opsKrzysztof Kozlowski1-1/+1
'struct lcd_ops' is not modified by core backlight code, so it can be made const for increased code safety. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240424-video-backlight-lcd-ops-v2-6-1aaa82b07bc6@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-03backlight: ili922x: Constify lcd_opsKrzysztof Kozlowski1-1/+1
'struct lcd_ops' is not modified by core backlight code, so it can be made const for increased code safety. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240424-video-backlight-lcd-ops-v2-5-1aaa82b07bc6@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-03backlight: hx8357: Constify lcd_opsKrzysztof Kozlowski1-1/+1
'struct lcd_ops' is not modified by core backlight code, so it can be made const for increased code safety. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240424-video-backlight-lcd-ops-v2-4-1aaa82b07bc6@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-03backlight: corgi_lcd: Constify lcd_opsKrzysztof Kozlowski1-1/+1
'struct lcd_ops' is not modified by core backlight code, so it can be made const for increased code safety. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240424-video-backlight-lcd-ops-v2-3-1aaa82b07bc6@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-03backlight: ams369fg06: Constify lcd_opsKrzysztof Kozlowski1-1/+1
'struct lcd_ops' is not modified by core backlight code, so it can be made const for increased code safety. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240424-video-backlight-lcd-ops-v2-2-1aaa82b07bc6@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-05-03backlight: lcd: Constify lcd_opsKrzysztof Kozlowski1-2/+2
'struct lcd_ops' passed in lcd_device_register() is not modified by core backlight code, so it can be made const for code safety. This allows drivers to also define the structure as const. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240424-video-backlight-lcd-ops-v2-1-1aaa82b07bc6@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-28backlight: Remove fb_blank from struct backlight_propertiesThomas Zimmermann3-4/+0
Remove the field fb_blank from struct backlight_properties and remove all code that still sets or reads it. Backlight blank status is now tracked exclusively in struct backlight_properties.state. The core backlight code keeps the fb_blank and state fields in sync, but doesn't do anything else with fb_blank. Several drivers initialize fb_blank to FB_BLANK_UNBLANK to enable the backlight. This is already the default for the state field. So we can delete the fb_blank code from core and drivers and rely on the state field. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Cc: Flavio Suligoi <f.suligoi@asem.it> Cc: Nicolas Ferre <nicolas.ferre@microchip.com> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com> Cc: Claudiu Beznea <claudiu.beznea@tuxon.dev> Tested-by: Flavio Suligoi <f.suligoi@asem.it> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/20240319093915.31778-7-tzimmermann@suse.de Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-28backlight: omap1: Replace FB_BLANK_ states with simple on/offThomas Zimmermann1-25/+18
The backlight is on for fb_blank eq FB_BLANK_UNBLANK, or off for any other value in fb_blank. But the field fb_blank in struct backlight_properties is deprecated and should not be used any longer. Replace the test for fb_blank in omap's backlight code with a simple boolean parameter and push the test into the update_status helper. Instead of reading fb_blank directly, decode the backlight device's status with backlight_is_blank(). Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240319093915.31778-4-tzimmermann@suse.de Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-28backlight: omap1: Remove unused struct omap_backlight_config.set_powerThomas Zimmermann1-3/+0
The callback set_power in struct omap_backlight_config is not implemented anywhere. Remove it from the structure and driver. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/20240319093915.31778-3-tzimmermann@suse.de Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-28backlight: Add controls_device callback to struct backlight_opsThomas Zimmermann4-19/+19
Replace check_fb with controls_device in struct backlight_ops. The new callback interface takes a Linux device instead of a framebuffer. Resolves one of the dependencies of backlight.h on fb.h. The few drivers that had custom implementations of check_fb can easily use the framebuffer's Linux device instead. Update them accordingly. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://lore.kernel.org/r/20240305162425.23845-11-tzimmermann@suse.de Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-28backlight: pwm-backlight: Remove struct backlight_ops.check_fbThomas Zimmermann1-12/+0
The internal check_fb callback from struct pwm_bl_data is never implemented. The driver's implementation of check_fb always returns true, which is the backlight core's default if no implementation has been set. So remove the code from the driver. v2: * reword commit message Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://lore.kernel.org/r/20240305162425.23845-7-tzimmermann@suse.de Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-28backlight: aat2870-backlight: Remove struct backlight.check_fbThomas Zimmermann1-7/+0
The driver's implementation of check_fb always returns true, which is the default if no implementation has been set. So remove the code from the driver. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://lore.kernel.org/r/20240305162425.23845-6-tzimmermann@suse.de Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-28backlight: Match backlight device against struct fb_info.bl_devThomas Zimmermann1-2/+6
Framebuffer drivers for devices with dedicated backlight are supposed to set struct fb_info.bl_dev to the backlight's respective device. Use the value to match backlight and framebuffer in the backlight core code. The code first tests against struct backlight_ops.check_ops. If this test succeeds, it performs the test against fbdev. So backlight drivers can override the later test as before. Fbdev's backlight support depends on CONFIG_FB_BACKLIGHT. To avoid ifdef in the code, the new helper fb_bl_device() returns the backlight device, or NULL if the config option has been disabled. The test in the backlight code will then do nothing. v4: * declare empty fb_bl_device() as static inline * export fb_bl_device() v3: * hide ifdef in fb_bl_device() (Lee) * no if-else blocks (Andy) Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://lore.kernel.org/r/20240305162425.23845-2-tzimmermann@suse.de Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-14Merge tag 'backlight-next-6.9' of ↵Linus Torvalds15-156/+254
git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight Pull backlight updates from Lee Jones: "New Drivers: - Add support for Kinetic KTD2801 Backlight Fix-ups: - Fix include lists; alphabetise, remove unused, explicitly add used - Device Tree binding adaptions/conversions/creation - Use dev_err_probe() to clean-up error paths - Use/convert to new/better APIs/helpers/MACROs instead of hand-rolling implementations Bug Fixes: - Fix changes of NULL pointer dereference - Remedy a bunch of logic errors - Initialise (zero) Backlight properties data structures" * tag 'backlight-next-6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight: (32 commits) backlight: pandora_bl: Drop unneeded ENOMEM error message backlight: lm3630a_bl: Simplify probe return on gpio request error backlight: lm3630a_bl: Handle deferred probe backlight: as3711_bl: Handle deferred probe backlight: bd6107: Handle deferred probe backlight: l4f00242t03: Simplify with dev_err_probe() backlight: gpio: Simplify with dev_err_probe() backlight: lp8788: Fully initialize backlight_properties during probe backlight: lm3639: Fully initialize backlight_properties during probe backlight: da9052: Fully initialize backlight_properties during probe backlight: lm3630a: Use backlight_get_brightness helper in update_status backlight: lm3630a: Don't set bl->props.brightness in get_brightness backlight: lm3630a: Initialize backlight_properties on init backlight: mp3309c: Fully initialize backlight_properties during probe backlight: mp3309c: Utilise temporary variable for struct device backlight: mp3309c: Use dev_err_probe() instead of dev_err() backlight: mp3309c: Make use of device properties dt-bindings: backlight: qcom-wled: Fix bouncing email addresses backlight: hx8357: Utilise temporary variable for struct device backlight: hx8357: Make use of dev_err_probe() ...
2024-03-07backlight: pandora_bl: Drop unneeded ENOMEM error messageKrzysztof Kozlowski1-3/+1
Core code already prints detailed information about failure of memory allocation. Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20240305-backlight-probe-v2-7-609b0cf24bde@linaro.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07backlight: lm3630a_bl: Simplify probe return on gpio request errorKrzysztof Kozlowski1-4/+2
Code can be simpler: return directly when devm_gpiod_get_optional() failed. Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20240305-backlight-probe-v2-6-609b0cf24bde@linaro.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07backlight: lm3630a_bl: Handle deferred probeKrzysztof Kozlowski1-4/+3
Don't pollute dmesg on deferred probe and simplify the code with dev_err_probe(). Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20240305-backlight-probe-v2-5-609b0cf24bde@linaro.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07backlight: as3711_bl: Handle deferred probeKrzysztof Kozlowski1-4/+2
Don't pollute dmesg on deferred probe and simplify the code with dev_err_probe(). Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20240305-backlight-probe-v2-4-609b0cf24bde@linaro.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07backlight: bd6107: Handle deferred probeKrzysztof Kozlowski1-6/+3
Don't pollute dmesg on deferred probe and simplify the code with dev_err_probe(). Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20240305-backlight-probe-v2-3-609b0cf24bde@linaro.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07backlight: l4f00242t03: Simplify with dev_err_probe()Krzysztof Kozlowski1-20/+14
Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20240305-backlight-probe-v2-2-609b0cf24bde@linaro.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07backlight: gpio: Simplify with dev_err_probe()Krzysztof Kozlowski1-7/+3
Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240305-backlight-probe-v2-1-609b0cf24bde@linaro.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07backlight: lp8788: Fully initialize backlight_properties during probeDaniel Thompson1-0/+1
props is stack allocated and the fields that are not explcitly set by the probe function need to be zeroed or we'll get undefined behaviour (especially so power/blank states)! Fixes: c5a51053cf3b ("backlight: add new lp8788 backlight driver") Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240220153532.76613-4-daniel.thompson@linaro.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07backlight: lm3639: Fully initialize backlight_properties during probeDaniel Thompson1-0/+1
props is stack allocated and the fields that are not explcitly set by the probe function need to be zeroed or we'll get undefined behaviour (especially so power/blank states)! Fixes: 0f59858d5119 ("backlight: add new lm3639 backlight driver") Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240220153532.76613-3-daniel.thompson@linaro.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07backlight: da9052: Fully initialize backlight_properties during probeDaniel Thompson1-0/+1
props is stack allocated and the fields that are not explcitly set by the probe function need to be zeroed or we'll get undefined behaviour (especially so power/blank states)! Fixes: 6ede3d832aaa ("backlight: add driver for DA9052/53 PMIC v1") Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240220153532.76613-2-daniel.thompson@linaro.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07backlight: lm3630a: Use backlight_get_brightness helper in update_statusLuca Weiss1-6/+8
As per documentation "drivers are expected to use this function in their update_status() operation to get the brightness value.". With this we can also drop the manual backlight_is_blank() handling since backlight_get_brightness() is already handling this correctly. Signed-off-by: Luca Weiss <luca@z3ntu.xyz> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240220-lm3630a-fixups-v1-3-9ca62f7e4a33@z3ntu.xyz Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07backlight: lm3630a: Don't set bl->props.brightness in get_brightnessLuca Weiss1-10/+4
There's no need to set bl->props.brightness, the get_brightness function is just supposed to return the current brightness and not touch the struct. With that done we can also remove the 'goto out' and just return the value. Fixes: 0c2a665a648e ("backlight: add Backlight driver for lm3630 chip") Signed-off-by: Luca Weiss <luca@z3ntu.xyz> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240220-lm3630a-fixups-v1-2-9ca62f7e4a33@z3ntu.xyz Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07backlight: lm3630a: Initialize backlight_properties on initLuca Weiss1-0/+1
The backlight_properties struct should be initialized to zero before using, otherwise there will be some random values in the struct. Fixes: 0c2a665a648e ("backlight: add Backlight driver for lm3630 chip") Signed-off-by: Luca Weiss <luca@z3ntu.xyz> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240220-lm3630a-fixups-v1-1-9ca62f7e4a33@z3ntu.xyz Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07backlight: mp3309c: Fully initialize backlight_properties during probeDaniel Thompson1-0/+1
props is stack allocated and, although this driver initializes all the fields that are not "owned" by the framework, we'd still like to ensure it is zeroed to avoid problems from this driver if the fields change. Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240220153532.76613-5-daniel.thompson@linaro.org Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07backlight: mp3309c: Utilise temporary variable for struct deviceAndy Shevchenko1-18/+12
We have a temporary variable to keep pointer to struct device. Utilise it where it makes sense. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Tested-by: Flavio Suligoi <f.suligoi@asem.it> Link: https://lore.kernel.org/r/20240208184313.2224579-4-andriy.shevchenko@linux.intel.com Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07backlight: mp3309c: Use dev_err_probe() instead of dev_err()Andy Shevchenko1-11/+7
Replace dev_err() with dev_err_probe(). This helps in simplifing code and standardizing the error output. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Tested-by: Flavio Suligoi <f.suligoi@asem.it> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240208184313.2224579-3-andriy.shevchenko@linux.intel.com Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07backlight: mp3309c: Make use of device propertiesAndy Shevchenko1-26/+18
Convert the module to be property provider agnostic and allow it to be used on non-OF platforms. Add mod_devicetable.h include. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Tested-by: Flavio Suligoi <f.suligoi@asem.it> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Link: https://lore.kernel.org/r/20240208184313.2224579-2-andriy.shevchenko@linux.intel.com Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07backlight: hx8357: Utilise temporary variable for struct deviceAndy Shevchenko1-4/+3
We have a temporary variable to keep pointer to struct device. Utilise it inside the ->probe() implementation. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://lore.kernel.org/r/20240201144951.294215-5-andriy.shevchenko@linux.intel.com Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07backlight: hx8357: Make use of dev_err_probe()Andy Shevchenko1-8/+4
Simplify the error handling in probe function by switching from dev_err() to dev_err_probe(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://lore.kernel.org/r/20240201144951.294215-4-andriy.shevchenko@linux.intel.com Signed-off-by: Lee Jones <lee@kernel.org>
2024-03-07backlight: hx8357: Move OF table closer to its consumerAndy Shevchenko1-13/+13
Move OF table near to the user. While at it, drop comma at terminator entry. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://lore.kernel.org/r/20240201144951.294215-3-andriy.shevchenko@linux.intel.com Signed-off-by: Lee Jones <lee@kernel.org>