summaryrefslogtreecommitdiff
path: root/drivers/video/pwm_backlight.c
AgeCommit message (Collapse)AuthorFilesLines
2021-07-16video: Check return value in pwm_backlight_of_to_plat()Simon Glass1-2/+4
This cannot actually fail, but check the value anyway to keep coverity happy. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Coverity (CID: 316351)
2021-04-10video: backlight: Support PWMs without a known period_nsAlper Nebi Yasak1-6/+14
The PWM device provided by Chrome OS EC doesn't really support anything other than setting a relative duty cycle. To support it as a backlight, this patch makes the PWM period optional in the device tree and pretends the valid brightness range is its period_ns. Also adds a sandbox test for a PWM channel that has a fixed period, checking that the resulting duty_cycle matches on a set_config() even if the requested period_ns can't be set. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-12-14dm: treewide: Rename ofdata_to_platdata() to of_to_plat()Simon Glass1-2/+2
This name is far too long. Rename it to remove the 'data' bits. This makes it consistent with the platdata->plat rename. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-12-14dm: treewide: Rename 'platdata' variables to just 'plat'Simon Glass1-2/+2
We use 'priv' for private data but often use 'platdata' for platform data. We can't really use 'pdata' since that is ambiguous (it could mean private or platform data). Rename some of the latter variables to end with 'plat' for consistency. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-12-13dm: treewide: Rename auto_alloc_size members to be shorterSimon Glass1-1/+1
This construct is quite long-winded. In earlier days it made some sense since auto-allocation was a strange concept. But with driver model now used pretty universally, we can shorten this to 'auto'. This reduces verbosity and makes it easier to read. Coincidentally it also ensures that every declaration is on one line, thus making dtoc's job easier. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-18video: backlight: fix pwm's duty cycle calculationDario Binacchi1-1/+1
For levels equal to the maximum value, the duty cycle must be equal to the period. Signed-off-by: Dario Binacchi <dariobin@libero.it> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-10-18video: backlight: fix pwm data structure descriptionDario Binacchi1-1/+1
The description of the 'max_level' field was incorrectly assigned to the 'min_level' field. Signed-off-by: Dario Binacchi <dariobin@libero.it>
2020-05-19common: Drop linux/delay.h from common headerSimon Glass1-0/+1
Move this uncommon header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-19common: Drop log.h from common headerSimon Glass1-0/+1
Move this header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-02-06dm: core: Create a new header file for 'compat' featuresSimon Glass1-0/+1
At present dm/device.h includes the linux-compatible features. This requires including linux/compat.h which in turn includes a lot of headers. One of these is malloc.h which we thus end up including in every file in U-Boot. Apart from the inefficiency of this, it is problematic for sandbox which needs to use the system malloc() in some files. Move the compatibility features into a separate header file. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-07video: backlight: fix pwm inversionMarc Dietrich1-0/+3
set_pwm() will always fail with -ENOSYS if pwm_ops set_invert() is not implemented, leaving the backlight dark. Fix this by returning no error if set_invert() is not implemented and no polarity change is requested. Fixes: 57e7775413 ("video: backlight: Parse PWM polarity cell") Signed-off-by: Marc Dietrich <marvin24@gmx.de>
2019-04-14video: backlight: Parse PWM polarity cellStefan Mavrodiev1-0/+11
This patch enables the reading of the polarity cell from a PWM phandle and calls pwm_set_invert(). Not all platforms have polarity cell, so skip if it's not pressent. Signed-off-by: Stefan Mavrodiev <stefan@olimex.com> Reviewed-by: Anatolij Gustschin <agust@denx.de>
2018-12-05video: backlight: Fix log message in enable_sequence()Simon Glass1-1/+1
This has an extra argument. Remove it. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Anatolij Gustschin <agust@denx.de>
2018-10-09panel: Expand the backlight supportSimon Glass1-34/+153
At present the panel can be turned on but not off, and the brightness cannot be controlled at run-time. Add a new API function to both the panel and backlight uclasses to handle this. Enhance the PWM backlight driver to deal with custom levels properly and allow the backlight to be turned on and off. Update the test to cover thes new features. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-05-07SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini1-2/+1
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
2018-04-27Remove unnecessary instances of DECLARE_GLOBAL_DATA_PTRTom Rini1-2/+0
We have a large number of places where while we historically referenced gd in the code we no longer do, as well as cases where the code added that line "just in case" during development and never dropped it. Signed-off-by: Tom Rini <trini@konsulko.com>
2018-03-06pwm-backlight: make power-supply as optionKever Yang1-12/+12
Some pwm backlight may not need 'power-supply', let's make it as option in pwm-backlight driver. Signed-off-by: Kever Yang <kever.yang@rock-chips.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
2017-07-11dm: video: Update pwm_backlight to support livetreeSimon Glass1-10/+12
Update this driver to support a live device tree. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Anatolij Gustschin <agust@denx.de> Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> Tested-on: Beaver, Jetson-TK1
2017-02-08dm: core: Replace of_offset with accessorSimon Glass1-1/+1
At present devices use a simple integer offset to record the device tree node associated with the device. In preparation for supporting a live device tree, which uses a node pointer instead, refactor existing code to access this field through an inline function. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-01-22dm: backlight: Add a driver for a PWM backlightSimon Glass1-0/+134
Many backlights need to use a PWM to control the brightness. Add a driver for this. It understands the standard device tree binding. Signed-off-by: Simon Glass <sjg@chromium.org>