aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/backlight
AgeCommit message (Collapse)Author
2022-01-27backlight: qcom-wled: Respect enabled-strings in set_brightnessMarijn Suijten
[ Upstream commit ec961cf3241153e0f27d850f1bf0f172e7d27a21 ] The hardware is capable of controlling any non-contiguous sequence of LEDs specified in the DT using qcom,enabled-strings as u32 array, and this also follows from the DT-bindings documentation. The numbers specified in this array represent indices of the LED strings that are to be enabled and disabled. Its value is appropriately used to setup and enable string modules, but completely disregarded in the set_brightness paths which only iterate over the number of strings linearly. Take an example where only string 2 is enabled with qcom,enabled_strings=<2>: this string is appropriately enabled but subsequent brightness changes would have only touched the zero'th brightness register because num_strings is 1 here. This is simply addressed by looking up the string for this index in the enabled_strings array just like the other codepaths that iterate over num_strings. Likewise enabled_strings is now also used in the autodetection path for consistent behaviour: when a list of strings is specified in DT only those strings will be probed for autodetection, analogous to how the number of strings that need to be probed is already bound by qcom,num-strings. After all autodetection uses the set_brightness helpers to set an initial value, which could otherwise end up changing brightness on a different set of strings. Fixes: 775d2ffb4af6 ("backlight: qcom-wled: Restructure the driver for WLED3") Fixes: 03b2b5e86986 ("backlight: qcom-wled: Add support for WLED4 peripheral") Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211115203459.1634079-10-marijn.suijten@somainline.org Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-01-27backlight: qcom-wled: Use cpu_to_le16 macro to perform conversionMarijn Suijten
[ Upstream commit 0a139358548968b2ff308257b4fbeec7badcc3e1 ] The kernel already provides appropriate primitives to perform endianness conversion which should be used in favour of manual bit-wrangling. Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211115203459.1634079-4-marijn.suijten@somainline.org Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-01-27backlight: qcom-wled: Override default length with qcom,enabled-stringsMarijn Suijten
[ Upstream commit 2b4b49602f9feca7b7a84eaa33ad9e666c8aa695 ] The length of qcom,enabled-strings as property array is enough to determine the number of strings to be enabled, without needing to set qcom,num-strings to override the default number of strings when less than the default (which is also the maximum) is provided in DT. This also introduces an extra warning when qcom,num-strings is set, denoting that it is not necessary to set both anymore. It is usually more concise to set just qcom,num-length when a zero-based, contiguous range of strings is needed (the majority of the cases), or to only set qcom,enabled-strings when a specific set of indices is desired. Fixes: 775d2ffb4af6 ("backlight: qcom-wled: Restructure the driver for WLED3") Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211115203459.1634079-6-marijn.suijten@somainline.org Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-01-27backlight: qcom-wled: Fix off-by-one maximum with default num_stringsMarijn Suijten
[ Upstream commit 5ada78b26f935f8751852dffa24f6b545b1d2517 ] When not specifying num-strings in the DT the default is used, but +1 is added to it which turns WLED3 into 4 and WLED4/5 into 5 strings instead of 3 and 4 respectively, causing out-of-bounds reads and register read/writes. This +1 exists for a deficiency in the DT parsing code, and is simply omitted entirely - solving this oob issue - by parsing the property separately much like qcom,enabled-strings. This also enables more stringent checks on the maximum value when qcom,enabled-strings is provided in the DT, by parsing num-strings after enabled-strings to allow it to check against (and in a subsequent patch override) the length of enabled-strings: it is invalid to set num-strings higher than that. The DT currently utilizes it to get around an incorrect fixed read of four elements from that array (has been addressed in a prior patch) by setting a lower num-strings where desired. Fixes: 93c64f1ea1e8 ("leds: add Qualcomm PM8941 WLED driver") Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org> Reviewed-By: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211115203459.1634079-5-marijn.suijten@somainline.org Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-01-27backlight: qcom-wled: Pass number of elements to read to read_u32_arrayMarijn Suijten
[ Upstream commit e29e24bdabfeddbf8b1a4ecac1af439a85150438 ] of_property_read_u32_array takes the number of elements to read as last argument. This does not always need to be 4 (sizeof(u32)) but should instead be the size of the array in DT as read just above with of_property_count_elems_of_size. To not make such an error go unnoticed again the driver now bails accordingly when of_property_read_u32_array returns an error. Surprisingly the indentation of newlined arguments is lining up again after prepending `rc = `. Fixes: 775d2ffb4af6 ("backlight: qcom-wled: Restructure the driver for WLED3") Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211115203459.1634079-3-marijn.suijten@somainline.org Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-01-27backlight: qcom-wled: Validate enabled string indices in DTMarijn Suijten
[ Upstream commit c05b21ebc5bce3ecc78c2c71afd76d92c790a2ac ] The strings passed in DT may possibly cause out-of-bounds register accesses and should be validated before use. Fixes: 775d2ffb4af6 ("backlight: qcom-wled: Restructure the driver for WLED3") Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org> Link: https://lore.kernel.org/r/20211115203459.1634079-2-marijn.suijten@somainline.org Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-11-18video: backlight: Drop maximum brightness override for brightness zeroMarek Vasut
commit 33a5471f8da976bf271a1ebbd6b9d163cb0cb6aa upstream. The note in c2adda27d202f ("video: backlight: Add of_find_backlight helper in backlight.c") says that gpio-backlight uses brightness as power state. This has been fixed since in ec665b756e6f7 ("backlight: gpio-backlight: Correct initial power state handling") and other backlight drivers do not require this workaround. Drop the workaround. This fixes the case where e.g. pwm-backlight can perfectly well be set to brightness 0 on boot in DT, which without this patch leads to the display brightness to be max instead of off. Fixes: c2adda27d202f ("video: backlight: Add of_find_backlight helper in backlight.c") Cc: <stable@vger.kernel.org> # 5.4+ Cc: <stable@vger.kernel.org> # 4.19.x: ec665b756e6f7: backlight: gpio-backlight: Correct initial power state handling Signed-off-by: Marek Vasut <marex@denx.de> Acked-by: Noralf Trønnes <noralf@tronnes.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-22backlight: ktd253: Stabilize backlightLinus Walleij
[ Upstream commit daa37361518bf2d1f591bbdaa7c68b2a43d7af48 ] Remove interrupt disablement during backlight setting. It is way to dangerous and makes platforms instable by having it miss vblank IRQs leading to the graphics derailing. The code is using ndelay() which is not available on platforms such as ARM and will result in 32 * udelay(1) which is substantial. Add some code to detect if an interrupt occurs during the tight loop and in that case just redo it from the top. Fixes: 5317f37e48b9 ("backlight: Add Kinetic KTD253 backlight driver") Cc: Stephan Gerhold <stephan@gerhold.net> Reported-by: newbyte@disroot.org Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-09-15backlight: pwm_bl: Improve bootloader/kernel device handoverDaniel Thompson
commit 79fad92f2e596f5a8dd085788a24f540263ef887 upstream. Currently there are (at least) two problems in the way pwm_bl starts managing the enable_gpio pin. Both occur when the backlight is initially off and the driver finds the pin not already in output mode and, as a result, unconditionally switches it to output-mode and asserts the signal. Problem 1: This could cause the backlight to flicker since, at this stage in driver initialisation, we have no idea what the PWM and regulator are doing (an unconfigured PWM could easily "rest" at 100% duty cycle). Problem 2: This will cause us not to correctly honour the post_pwm_on_delay (which also risks flickers). Fix this by moving the code to configure the GPIO output mode until after we have examines the handover state. That allows us to initialize enable_gpio to off if the backlight is currently off and on if the backlight is on. Cc: stable@vger.kernel.org Reported-by: Marek Vasut <marex@denx.de> Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org> Acked-by: Marek Vasut <marex@denx.de> Tested-by: Marek Vasut <marex@denx.de> Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-07-20backlight: lm3630a: Fix return code of .update_status() callbackUwe Kleine-König
[ Upstream commit b9481a667a90ec739995e85f91f3672ca44d6ffa ] According to <linux/backlight.h> .update_status() is supposed to return 0 on success and a negative error code otherwise. Adapt lm3630a_bank_a_update_status() and lm3630a_bank_b_update_status() to actually do it. While touching that also add the error code to the failure message. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-07-14backlight: lm3630a_bl: Put fwnode in error case during ->probe()Andy Shevchenko
[ Upstream commit 6d1c32dbedd7d7e7372aa38033ec8782c39f6379 ] device_for_each_child_node() bumps a reference counting of a returned variable. We have to balance it whenever we return to the caller. Cc: Brian Masney <masneyb@onstation.org> Cc: Dan Murphy <dmurphy@ti.com> Fixes: 8fbce8efe15cd ("backlight: lm3630a: Add firmware node support") Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Brian Masney <masneyb@onstation.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-05-11backlight: qcom-wled: Fix FSC update issue for WLED5Kiran Gunda
[ Upstream commit 4d6e9cdff7fbb6bef3e5559596fab3eeffaf95ca ] Currently, for WLED5, the FSC (Full scale current) setting is not updated properly due to driver toggling the wrong register after an FSC update. On WLED5 we should only toggle the MOD_SYNC bit after a brightness update. For an FSC update we need to toggle the SYNC bits instead. Fix it by adopting the common wled3_sync_toggle() for WLED5 and introducing new code to the brightness update path to compensate. Signed-off-by: Kiran Gunda <kgunda@codeaurora.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-05-11backlight: qcom-wled: Use sink_addr for sync toggleObeida Shamoun
[ Upstream commit cdfd4c689e2a52c313b35ddfc1852ff274f91acb ] WLED3_SINK_REG_SYNC is, as the name implies, a sink register offset. Therefore, use the sink address as base instead of the ctrl address. This fixes the sync toggle on wled4, which can be observed by the fact that adjusting brightness now works. It has no effect on wled3 because sink and ctrl base addresses are the same. This allows adjusting the brightness without having to disable then reenable the module. Signed-off-by: Obeida Shamoun <oshmoun100@googlemail.com> Signed-off-by: Konrad Dybcio <konrad.dybcio@somainline.org> Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Acked-by: Kiran Gunda <kgunda@codeaurora.org> Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-10-14Merge tag 'backlight-next-5.10' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight Pull backlight updates from Lee Jones: "New Drivers: - Add support for KTD253 Fix-ups: - Add Device Tree documentation; common, kinetic,ktd253 - Use correct header(s); tosa_lcd, tosa_bl Bug Fixes: - Fix refcount imbalance; sky81452-backlight" * tag 'backlight-next-5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight: backlight: tosa_bl: Include the right header backlight: tosa_lcd: Include the right header backlight: Add Kinetic KTD253 backlight driver dt-bindings: backlight: Add Kinetic KTD253 bindings dt-bindings: backlight: Add some common backlight properties backlight: sky81452-backlight: Fix refcount imbalance on error
2020-09-08backlight: tosa_bl: Include the right headerLinus Walleij
The Tosa backlight driver was converted to use GPIO descriptors in 0b0cb52bd80eda76c4b9921f5cf9c1b709d44e83 ("video: backlight: tosa: Use GPIO lookup table") but still includes <linux/gpio.h> rather than <linux/gpio/consumer.h>. Fix it. Cc: Arnd Bergmann <arnd@arndb.de> Cc: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-09-08backlight: tosa_lcd: Include the right headerLinus Walleij
The Tosa backlight LCDE driver was converted to use GPIO descriptors in 0b0cb52bd80eda76c4b9921f5cf9c1b709d44e83 ("video: backlight: tosa: Use GPIO lookup table") but still includes <linux/gpio.h> rather than <linux/gpio/consumer.h>. Fix it. Cc: Arnd Bergmann <arnd@arndb.de> Cc: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-08-28backlight: Add Kinetic KTD253 backlight driverLinus Walleij
The Kinetic KTD253 backlight driver is controlled with a single GPIO line, but still supports a range of brightness settings by sending fast pulses on the line. This is based off the source code release for the Samsung GT-S7710 mobile phone. Cc: Sam Ravnborg <sam@ravnborg.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-08-28backlight: sky81452-backlight: Fix refcount imbalance on errordinghao.liu@zju.edu.cn
When of_property_read_u32_array() returns an error code, a pairing refcount decrement is needed to keep np's refcount balanced. Fixes: f705806c9f355 ("backlight: Add support Skyworks SKY81452 backlight driver") Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-08-23treewide: Use fallthrough pseudo-keywordGustavo A. R. Silva
Replace the existing /* fall through */ comments and its variants with the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary fall-through markings when it is the case. [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
2020-08-14Merge tag 'pwm/for-5.9-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm Pull pwm updates from Thierry Reding: "The majority of this batch is conversion of the PWM period and duty cycle to 64-bit unsigned integers, which is required so that some types of hardware can generate the full range of signals that they're capable of. The remainder is mostly minor fixes and cleanups" * tag 'pwm/for-5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm: pwm: bcm-iproc: handle clk_get_rate() return pwm: Replace HTTP links with HTTPS ones pwm: omap-dmtimer: Repair pwm_omap_dmtimer_chip's broken kerneldoc header pwm: mediatek: Provide missing kerneldoc description for 'soc' arg pwm: bcm-kona: Remove impossible comparison when validating duty cycle pwm: bcm-iproc: Remove impossible comparison when validating duty cycle pwm: iqs620a: Use lowercase hexadecimal literals for consistency pwm: Convert period and duty cycle to u64 clk: pwm: Use 64-bit division function backlight: pwm_bl: Use 64-bit division function pwm: sun4i: Use nsecs_to_jiffies to avoid a division pwm: sifive: Use 64-bit division macro pwm: iqs620a: Use 64-bit division pwm: imx27: Use 64-bit division macro pwm: imx-tpm: Use 64-bit division macro pwm: clps711x: Use 64-bit division macro hwmon: pwm-fan: Use 64-bit division macro drm/i915: Use 64-bit division macro
2020-08-11Merge tag 'backlight-next-5.9' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight Pull backlight updates from Lee Jones: "Core Framework: - Trivial: Code refactoring - New API backlight_is_blank() - New API backlight_get_brightness() - Additional/reworked documentation - Remove 'extern' labels from prototypes - Drop backlight_put() - Staticify of_find_backlight() Driver Removal: - Removal of unused OT200 driver - Removal of unused Generic Backlight driver Fix-ups - Bunch of W=1 warning fixes - Convert to GPIO descriptors; sky81452 - Move platform data handling into driver; sky81452 - Remove superfluous code; lms501kf03 - Many instances of using new APIs" * tag 'backlight-next-5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight: (34 commits) video: backlight: cr_bllcd: Remove unused variable 'intensity' backlight: backlight: Make of_find_backlight static backlight: backlight: Drop backlight_put() backlight: Use backlight_get_brightness() throughout backlight: jornada720_bl: Introduce backlight_is_blank() backlight: gpio_backlight: Simplify update_status() backlight: cr_bllcd: Introduce gpio-backlight semantics backlight: as3711_bl: Simplify update_status backlight: backlight: Introduce backlight_get_brightness() doc-rst: Wire-up Backlight kernel-doc documentation backlight: backlight: Add overview and update existing doc backlight: backlight: Drop extern from prototypes backlight: generic_bl: Remove this driver as it is unused backlight: backlight: Document enums in backlight.h backlight: backlight: Document inline functions in backlight.h backlight: backlight: Improve backlight_device documentation backlight: backlight: Improve backlight_properties documentation backlight: backlight: Improve backlight_ops documentation backlight: backlight: Add backlight_is_blank() backlight: backlight: Refactor fb_notifier_callback() ...
2020-07-21video: backlight: cr_bllcd: Remove unused variable 'intensity'Lee Jones
Fixes the following kernel build warning: drivers/video/backlight/cr_bllcd.c: In function ‘cr_backlight_set_intensity’: drivers/video/backlight/cr_bllcd.c:62:6: warning: unused variable ‘intensity’ [-Wunused-variable] 62 | int intensity = bd->props.brightness; | ^~~~~~~~~ Cc: Jingoo Han <jingoohan1@gmail.com> Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Cc: dri-devel@lists.freedesktop.org Cc: linux-fbdev@vger.kernel.org Fixes: 24d34617c24f ("backlight: cr_bllcd: Introduce gpio-backlight semantics") Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-07-20backlight: backlight: Make of_find_backlight staticSam Ravnborg
There are no external users of of_find_backlight, as they have all changed to use the managed version. Make of_find_backlight static to prevent new external users. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-07-20backlight: backlight: Drop backlight_put()Sam Ravnborg
There are no external users of backlight_put(). Drop it and open code the two users in backlight.c. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-07-20backlight: Use backlight_get_brightness() throughoutSam Ravnborg
Introduce the backlight_get_brightness() helper in all video/backlight/* drivers. This simplifies the code and align the implementation of the update_status() operation across the different backlight drivers. Some of the drivers gains a little extra functionality by the change as they now respect the fb_blank() ioctl. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-07-20backlight: jornada720_bl: Introduce backlight_is_blank()Sam Ravnborg
Use the backlight_is_blank() helper to simplify the code a bit. The jornada720_bl driver distinguish between backlight off and brightness set to 0. Thus this driver turn off backlight only when backlight_is_blank() returns true. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-07-20backlight: gpio_backlight: Simplify update_status()Sam Ravnborg
Introduce the use of backlight_get_brightness() to simplify the update_status() operation. With the simpler implementation drop the gpio_backlight_get_next_brightness() helper as it was now a one-liner. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-07-20backlight: cr_bllcd: Introduce gpio-backlight semanticsSam Ravnborg
cr_bllcd can turn backlight ON or OFF. Fix semantitics so they equals what we know from gpio-backlight. brightness == 0 => backlight off brightness == 1 => backlight on Use the backlight_get_brightness() helper to simplify the code. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-07-20backlight: as3711_bl: Simplify update_statusSam Ravnborg
Replaces the open-coded checks of the state, with the backlight_get_brightness() helper. This increases readability of the code and align the functionality across the drivers. Furthermore drop the debug prints in update_status(). If we need debug printing then we can add it to the backlight core. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-07-20backlight: backlight: Add overview and update existing docSam Ravnborg
Add overview chapter to backlight.c. Update existing kernel-doc to follow a more consistent style and drop kernel-doc for deprecated functions. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-07-20backlight: generic_bl: Remove this driver as it is unusedSam Ravnborg
The backlight_bl driver required initialization using struct generic_bl_info. As there are no more references to this struct there is no users left. So it is safe to delete the driver. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-07-20backlight: backlight: Refactor fb_notifier_callback()Sam Ravnborg
Increase readability of fb_notifier_callback() by removing a few indent levels. No functional change. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-07-08video: backlight: sky81452-backlight: Fix some kerneldoc issuesLee Jones
Firstly, all lines must begin with a '*'. Secondly, arg descriptions must be spelt correctly, so fix misspelling of 'gpioD_enable' and 'short_detecTion_threshold' Fixes the following W=1 kernel build warning(s): drivers/video/backlight/sky81452-backlight.c:46: warning: bad line: If it is not defined, default name is lcd-backlight. drivers/video/backlight/sky81452-backlight.c:64: warning: Function parameter or member 'gpiod_enable' not described in 'sky81452_bl_platform_data' drivers/video/backlight/sky81452-backlight.c:64: warning: Function parameter or member 'short_detection_threshold' not described in 'sky81452_bl_platform_data' Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-07-06backlight: qcom-wled: Remove unused configs for LED3 and LED4Lee Jones
Fixes W=1 warnings: drivers/video/backlight/qcom-wled.c:1294:34: warning: ‘wled4_string_cfg’ defined but not used [-Wunused-const-variable=] 1294 | static const struct wled_var_cfg wled4_string_cfg = { | ^~~~~~~~~~~~~~~~ drivers/video/backlight/qcom-wled.c:1290:34: warning: ‘wled3_string_cfg’ defined but not used [-Wunused-const-variable=] 1290 | static const struct wled_var_cfg wled3_string_cfg = { | ^~~~~~~~~~~~~~~~ Cc: Andy Gross <agross@kernel.org> Cc: Bjorn Andersson <bjorn.andersson@linaro.org> Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Cc: linux-arm-msm@vger.kernel.org Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-07-06backlight: lm3630a_bl: Remove invalid checks for unsigned int < 0Lee Jones
unsigned ints 'sources' and 'bank' cannot be less than LM3630A_SINK_0 (0) and LM3630A_BANK_0 (0) respecitively, so change the logic to only check for thier two possible valid values. Fixes W=1 warnings: drivers/video/backlight/lm3630a_bl.c: In function ‘lm3630a_parse_led_sources’: drivers/video/backlight/lm3630a_bl.c:394:18: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] 394 | if (sources[i] < LM3630A_SINK_0 || sources[i] > LM3630A_SINK_1) | ^ drivers/video/backlight/lm3630a_bl.c: In function ‘lm3630a_parse_bank’: drivers/video/backlight/lm3630a_bl.c:415:11: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] 415 | if (bank < LM3630A_BANK_0 || bank > LM3630A_BANK_1) | ^ Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Cc: Daniel Jeong <gshark.jeong@gmail.com> Cc: LDD MLP <ldd-mlp@list.ti.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-07-06backlight: backlight: Supply description for function args in existing ↵Lee Jones
Kerneldocs Kerneldoc syntax is used, but not complete. Descriptions required. Prevents warnings like: drivers/video/backlight/backlight.c:329: warning: Function parameter or member 'reason' not described in 'backlight_force_update' drivers/video/backlight/backlight.c:354: warning: Function parameter or member 'props' not described in 'backlight_device_register' Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Cc: Jamey Hicks <jamey.hicks@hp.com> Cc: Andrew Zabolotny <zap@homelink.ru> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-07-06backlight: ili922x: Add missing kerneldoc description for ↵Lee Jones
ili922x_reg_dump()'s arg Kerneldoc syntax is used, but not complete. Descriptions required. Prevents warnings like: drivers/video/backlight/ili922x.c:298: warning: Function parameter or member 'spi' not described in 'ili922x_reg_dump' Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Cc: Software Engineering <sbabic@denx.de> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-07-06backlight: ili922x: Remove invalid use of kerneldoc syntaxLee Jones
Kerneldoc is for documenting function arguments and return values. Prevents warnings like: drivers/video/backlight/ili922x.c:127: warning: cannot understand function prototype: 'int ili922x_id = 1; ' drivers/video/backlight/ili922x.c:136: warning: cannot understand function prototype: 'struct ili922x ' Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Cc: Software Engineering <sbabic@denx.de> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-07-06backlight: ili922x: Add missing kerneldoc descriptions for CHECK_FREQ_REG() argsLee Jones
Kerneldoc syntax is used, but not complete. Descriptions required. Prevents warnings like: drivers/video/backlight/ili922x.c:116: warning: Function parameter or member 's' not described in 'CHECK_FREQ_REG' drivers/video/backlight/ili922x.c:116: warning: Function parameter or member 'x' not described in 'CHECK_FREQ_REG' Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Cc: Software Engineering <sbabic@denx.de> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-07-06backlight: lcd: Add missing kerneldoc entry for 'struct device parent'Lee Jones
This has been missing since the conversion to 'struct device' in 2007. Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Cc: Jamey Hicks <jamey.hicks@hp.com> Cc: Andrew Zabolotny <zap@homelink.ru> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-07-06backlight: lms501kf03: Remove unused const variablesLee Jones
W=1 kernel build reports: drivers/video/backlight/lms501kf03.c:96:28: warning: ‘seq_sleep_in’ defined but not used [-Wunused-const-variable=] 96 | static const unsigned char seq_sleep_in[] = { | ^~~~~~~~~~~~ drivers/video/backlight/lms501kf03.c:92:28: warning: ‘seq_up_dn’ defined but not used [-Wunused-const-variable=] 92 | static const unsigned char seq_up_dn[] = { | ^~~~~~~~~ Either 'seq_sleep_in' nor 'seq_up_dn' have been used since the driver first landed in 2013. Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-07-01backlight: lms501kf03: Drop unused includeLinus Walleij
This driver includes <linux/gpio.h> but does not use any symbols from that file, drop the include. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-07-01backlight: Delete the OT200 backlight driverLinus Walleij
This driver has no in-kernel users. The device can only be populated by board files since it does not support device tree nor ACPI, and nothing in the kernel creates a device named "ot200-backlight". This driver has been in the kernel since 2012. If it is used by out-of-tree code that code should have been upstreamed by now, it's been 8 years. It uses the idiomatic forked GPIO of the CS5535 which combines pin control and GPIO into its private custom interface, which causes me a headache because that is not how we do things these days: we creates separate pin control and GPIO drivers. Delete this unused driver. Cc: Christian Gmeiner <christian.gmeiner@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-07-01backlight: sky81452: Privatize platform dataLinus Walleij
The only way the platform data for the SKY81452 ever gets populated is through the device tree. The MFD device is bothered with this for no reason at all. Just allocate the platform data in the driver and be happy. Cc: Gyungoh Yoo <jack.yoo@skyworksinc.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-07-01backlight: sky81452: Convert to GPIO descriptorsLinus Walleij
The SKY81452 backlight driver just obtains a GPIO (named "gpios" in the device tree) drives it high and leaves it high until the driver is removed. Switch to use GPIO descriptors for this, simple and straight-forward. Cc: Gyungoh Yoo <jack.yoo@skyworksinc.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-06-19video: backlight: tosa_lcd: convert to use i2c_new_client_device()Wolfram Sang
Move away from the deprecated API and return the shiny new ERRPTR where useful. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Wolfram Sang <wsa@kernel.org>
2020-06-17backlight: pwm_bl: Use 64-bit division functionGuru Das Srinagesh
Since the PWM framework is switching struct pwm_state.period's datatype to u64, prepare for this transition by using div_u64 to handle a 64-bit dividend instead of a straight division operation. Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2020-06-16backlight: lm3533_bl: Use kobj_to_dev() insteadWang Qing
Use kobj_to_dev() instead of container_of() Signed-off-by: Wang Qing <wangqing@vivo.com> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-05-11backlight: Add backlight_device_get_by_name()Noralf Trønnes
Add a way to lookup a backlight device based on its name. Will be used by a USB display gadget getting the name from configfs. Signed-off-by: Noralf Trønnes <noralf@tronnes.org> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Acked-by: Jingoo Han <jingoohan1@gmail.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2020-05-06backlight: qcom-wled: Add support for WLED5 peripheral that is present on ↵Subbaraman Narayanamurthy
PM8150L PMICs PM8150L WLED supports the following: - Two modulators and each sink can use any of the modulator - Multiple CABC selection options from which one can be selected/enabled - Multiple brightness width selection (12 bits to 15 bits) Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org> Signed-off-by: Kiran Gunda <kgunda@codeaurora.org> Reviewed-by: Daniel Thompson <daniel.thompson@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>