* Re: EXTERNAL: [PATCH 0/2] backlight: mp3309c: Drop pwm_apply_args()
From: Uwe Kleine-König @ 2025-07-29 20:17 UTC (permalink / raw)
To: FLAVIO SULIGOI, Lee Jones, Daniel Thompson, Jingoo Han
Cc: Helge Deller, Daniel Thompson, dri-devel@lists.freedesktop.org,
linux-fbdev@vger.kernel.org, linux-pwm@vger.kernel.org
In-Reply-To: <PH0PR22MB37899F7A6262C599400AF912FA4FA@PH0PR22MB3789.namprd22.prod.outlook.com>
[-- Attachment #1: Type: text/plain, Size: 1136 bytes --]
[Updating Daniel's email address as the linaro one stopped working]
Hello,
On Mon, Jul 07, 2025 at 03:44:25PM +0000, FLAVIO SULIGOI wrote:
> > the first patch of this series is what I really care about: There are
> > hardly any drivers left that use pwm_apply_args(). When all of them are
> > converted to not use it any more, I intend to drop that function.
> >
> > The 2nd patch is just a change that I noticed while editing the driver
> > that is IMHO nice. If you don't agree and only apply the first patch, I
> > won't argue. It's an alternative approach to what Daniel Thompson did in
> > commit 7ee6478d5aa9 ("backlight: mp3309c: Fully initialize
> > backlight_properties during probe").
>
> I've tested your patches on my board and all is ok.
@Flavio:
A Tested-by in this reply to the cover letter is understood by b4 (which
is the tool most maintainers use to apply patches from the mailing
list). So there wouldn't have been a need to reply to each mail
individually.
@backlight maintainers:
This patch didn't make it into next yet, I guess it's too late for
6.17-rc1 now?
Best regards
Uwe
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply
* [PATCH 1/2] leds: Drop duplicate LEDS_EXPRESSWIRE config
From: Duje Mihanović @ 2025-07-29 17:18 UTC (permalink / raw)
To: Lee Jones, Pavel Machek, Daniel Thompson, Jingoo Han,
Helge Deller
Cc: Randy Dunlap, linux-leds, linux-kernel, dri-devel, linux-fbdev,
Duje Mihanović
In-Reply-To: <20250729-expresswire-dep-fix-v1-0-635cd4cc746b@dujemihanovic.xyz>
While moving said config symbol out of the "if NEW_LEDS" block, I
accidentally left a copy inside that block. Remove it.
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/all/b6c481bb-e854-405e-a428-90301789fe20@infradead.org/
Fixes: 2cd0d1db31e7 ("leds: expresswire: Don't depend on NEW_LEDS")
Signed-off-by: Duje Mihanović <duje@dujemihanovic.xyz>
---
drivers/leds/Kconfig | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index 6e3dce7e35a490df050cb4cd8e98611028c8dce1..8098b7b49c9decb591a894fe514a7ee757da5b44 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -214,10 +214,6 @@ config LEDS_EL15203000
To compile this driver as a module, choose M here: the module
will be called leds-el15203000.
-config LEDS_EXPRESSWIRE
- bool
- depends on GPIOLIB
-
config LEDS_TURRIS_OMNIA
tristate "LED support for CZ.NIC's Turris Omnia"
depends on LEDS_CLASS_MULTICOLOR
--
2.50.1
^ permalink raw reply related
* [PATCH 2/2] backlight: ktd2801: Depend on GPIOLIB
From: Duje Mihanović @ 2025-07-29 17:18 UTC (permalink / raw)
To: Lee Jones, Pavel Machek, Daniel Thompson, Jingoo Han,
Helge Deller
Cc: Randy Dunlap, linux-leds, linux-kernel, dri-devel, linux-fbdev,
Duje Mihanović
In-Reply-To: <20250729-expresswire-dep-fix-v1-0-635cd4cc746b@dujemihanovic.xyz>
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>
Link: https://lore.kernel.org/all/b6c481bb-e854-405e-a428-90301789fe20@infradead.org/
Signed-off-by: Duje Mihanović <duje@dujemihanovic.xyz>
---
drivers/video/backlight/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index d9374d208ceebbf8b3c27976e9cb4d725939b942..37341474beb9982f7099711e5e2506081061df46 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -185,6 +185,7 @@ config BACKLIGHT_KTD253
config BACKLIGHT_KTD2801
tristate "Backlight Driver for Kinetic KTD2801"
+ depends on GPIOLIB || COMPILE_TEST
select LEDS_EXPRESSWIRE
help
Say Y to enable the backlight driver for the Kinetic KTD2801 1-wire
--
2.50.1
^ permalink raw reply related
* [PATCH 0/2] ExpressWire dependency fixes
From: Duje Mihanović @ 2025-07-29 17:18 UTC (permalink / raw)
To: Lee Jones, Pavel Machek, Daniel Thompson, Jingoo Han,
Helge Deller
Cc: Randy Dunlap, linux-leds, linux-kernel, dri-devel, linux-fbdev,
Duje Mihanović
Hello,
This tiny series fixes two dependency issues with the ExpressWire
library and the KTD2801 backlight driver. Thanks to Randy for reporting
these.
Signed-off-by: Duje Mihanović <duje@dujemihanovic.xyz>
---
Duje Mihanović (2):
leds: Drop duplicate LEDS_EXPRESSWIRE config
backlight: ktd2801: Depend on GPIOLIB
drivers/leds/Kconfig | 4 ----
drivers/video/backlight/Kconfig | 1 +
2 files changed, 1 insertion(+), 4 deletions(-)
---
base-commit: 038d61fd642278bab63ee8ef722c50d10ab01e8f
change-id: 20250729-expresswire-dep-fix-ba5b8bab83cb
Best regards,
--
Duje Mihanović <duje@dujemihanovic.xyz>
^ permalink raw reply
* Re: [PATCH 1/4] dt-bindings: backlight: Add max25014 bindings
From: Maud Spierings @ 2025-07-28 6:33 UTC (permalink / raw)
To: Rob Herring
Cc: Shawn Guo, Jingoo Han, devicetree, linux-kernel, Daniel Thompson,
Helge Deller, linux-fbdev, Lee Jones, Fabio Estevam,
Krzysztof Kozlowski, Sascha Hauer, dri-devel, linux-leds,
Pavel Machek, Pengutronix Kernel Team, imx, linux-arm-kernel,
Conor Dooley
In-Reply-To: <20250725195143.GA1735522-robh@kernel.org>
On 7/25/25 21:51, Rob Herring wrote:
> On Fri, Jul 25, 2025 at 04:06:45PM +0200, Maud Spierings wrote:
>>
>>
>> On 7/25/25 15:27, Rob Herring (Arm) wrote:
>>>
>>> On Fri, 25 Jul 2025 13:09:23 +0200, Maud Spierings wrote:
>>>> The Maxim MAX25014 is a 4-channel automotive grade backlight driver IC
>>>> with intgrated boost controller.
>>>>
>>>> Signed-off-by: Maud Spierings <maudspierings@gocontroll.com>
>>>> ---
>>>> .../bindings/leds/backlight/maxim,max25014.yaml | 78 ++++++++++++++++++++++
>>>> MAINTAINERS | 5 ++
>>>> 2 files changed, 83 insertions(+)
>>>>
>>>
>>> My bot found errors running 'make dt_binding_check' on your patch:
>>
>> Pretty sure I did that, but I've never gotten those tools to work quite
>> right, I'll look at it for v2
>
> What's the issue?
I'm on arch, and I believe there is some specific version dependencies
in some of the libraries used, so I have a venv for doing kernel work
but it still doesn't seem quite happy sometimes. I may have just messed
something in that part and thought I did it correctly, but didn't.
I think I have it working properly now though, just did a quick test and
it worked as intended.
^ permalink raw reply
* Re: [PATCH 2/2] fbdev: remove metronomefb
From: Helge Deller @ 2025-07-27 18:11 UTC (permalink / raw)
To: Arnd Bergmann, Thomas Zimmermann; +Cc: linux-fbdev, dri-devel
In-Reply-To: <20250625131511.3366522-2-arnd@kernel.org>
On 6/25/25 15:12, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> This driver has not worked correctly for many years, and the only in-tree
> reference to it is going away as well, so remove the driver now.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> Documentation/fb/index.rst | 1 -
> Documentation/fb/metronomefb.rst | 38 --
> drivers/video/fbdev/Kconfig | 9 -
> drivers/video/fbdev/Makefile | 1 -
> drivers/video/fbdev/metronomefb.c | 724 ------------------------------
> include/video/metronomefb.h | 57 ---
> 6 files changed, 830 deletions(-)
> delete mode 100644 Documentation/fb/metronomefb.rst
> delete mode 100644 drivers/video/fbdev/metronomefb.c
> delete mode 100644 include/video/metronomefb.h
applied.
Thanks!
Helge
^ permalink raw reply
* Re: [PATCH] fbdev: pm3fb: Fix potential divide by zero
From: Helge Deller @ 2025-07-27 18:17 UTC (permalink / raw)
To: Alex Guo, Geert Uytterhoeven; +Cc: dri-devel, linux-fbdev, linux-kernel
In-Reply-To: <CAMuHMdW=GyUHsfqtSD8iYaV_nRszEunaDMCoL6zWf5_bPS0T4Q@mail.gmail.com>
Hi Alex,
On 6/12/25 11:29, Geert Uytterhoeven wrote:
> On Wed, 11 Jun 2025 at 18:12, Alex Guo <alexguo1023@gmail.com> wrote:
>>> On Sat, 7 Jun 2025 at 22:14, Alex Guo <alexguo1023@gmail.com> wrote:
>>>> variable var->pixclock can be set by user. In case it equals to
>>>> zero, divide by zero would occur in pm3fb_check_var. Similar
>>>> crashes have happened in other fbdev drivers. There is no check
>>>> and modification on var->pixclock along the call chain to
>>>> pm3fb_check_var. So we fix this by checking whether 'pixclock'
>>>> is zero.
>>>>
>>>> Similar commit: commit 16844e58704 ("video: fbdev: tridentfb:
>>>> Error out if 'pixclock' equals zero")
>>>>
>>>> Signed-off-by: Alex Guo <alexguo1023@gmail.com>
>>>
>>> Thanks for your patch, which is now commit 59d1fc7b3e1ae9d4
>>> ("fbdev: pm3fb: fix potential divide by zero") in fbdev/for-next.
>>>
>>>> --- a/drivers/video/fbdev/pm3fb.c
>>>> +++ b/drivers/video/fbdev/pm3fb.c
>>>> @@ -998,6 +998,9 @@ static int pm3fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
>>>> return -EINVAL;
>>>> }
>>>>
>>>> + if (!var->pixclock)
>>>> + return -EINVAL;
>>>
>>> While this fixes the crash, this is correct behavior for an fbdev driver.
>>> When a value is invalid, it should be rounded up to a valid value instead,
>>> if possible.
>>
>> Thanks for your confirmation and suggestions.
>>
>> I added this patch based on existing checks on var->pixclock in other drivers, such as savagefb_check_var, nvidiafb_check_var, etc.
>> Are you suggesting that it is better to replace an invalid value (var->pixclock == 0) with a default valid value, instead of returning -EINVAL?
>
> Indeed.
>
>> If so, could you advise what a suitable default value would be for this case?
>
> The answer is hidden in the existing check below:
>
>>>> +
>>>> if (PICOS2KHZ(var->pixclock) > PM3_MAX_PIXCLOCK) {
>>>> DPRINTK("pixclock too high (%ldKHz)\n",
>>>> PICOS2KHZ(var->pixclock));
>>>> return -EINVAL;
>>>> }
>
> It can be replaced by:
>
> if (var->pixclock <= KHZ2PICOS(PM3_MAX_PIXCLOCK))
> var->pixclock = KHZ2PICOS(PM3_MAX_PIXCLOCK) + 1;
>
> The "+ 1" is needed because of rounding.
You sent a whole bunch of patches [1] which check pixclock against
zero, but you don't set the default value as Geert pointed out
above. Can you maybe revise your patches accordingly?
Helge
[1] https://patchwork.kernel.org/project/linux-fbdev/list/
^ permalink raw reply
* Re: [PATCH] fbdev: Fix typo in Kconfig text for FB_DEVICE
From: Helge Deller @ 2025-07-27 18:06 UTC (permalink / raw)
To: daniel.palmer; +Cc: linux-fbdev, dri-devel
In-Reply-To: <20250725-fbdev-typo-v1-1-f9fd1418cb51@sony.com>
On 7/25/25 07:30, Daniel Palmer via B4 Relay wrote:
> From: Daniel Palmer <daniel.palmer@sony.com>
>
> Seems like someone hit 'c' when they meant to hit 'd'.
>
> Signed-off-by: Daniel Palmer <daniel.palmer@sony.com>
> ---
> drivers/video/fbdev/core/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
applied.
Thanks!
Helge
^ permalink raw reply
* Re: [PATCH] fbdev: Check fb_add_videomode to prevent null-ptr-deref
From: Helge Deller @ 2025-07-27 18:04 UTC (permalink / raw)
To: Chenyuan Yang; +Cc: linux-fbdev, dri-devel, imx
In-Reply-To: <20250724032534.1638187-1-chenyuan0y@gmail.com>
On 7/24/25 05:25, Chenyuan Yang wrote:
> fb_add_videomode() can fail with -ENOMEM when its internal kmalloc()
> cannot allocate a struct fb_modelist.
> If that happens, the modelist stays empty but the driver continues to
> register.
> Add a check for its return value to prevent poteintial null-ptr-deref,
> which is similar to the commit 17186f1f90d3
> ("fbdev: Fix do_register_framebuffer to prevent null-ptr-deref in fb_videomode_to_var").
>
> Fixes: 1b6c79361ba5 ("video: imxfb: Add DT support")
> Signed-off-by: Chenyuan Yang <chenyuan0y@gmail.com>
> ---
> drivers/video/fbdev/imxfb.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
applied.
Thanks!
Helge
^ permalink raw reply
* Re: [PATCH] fbdev: svgalib: Clean up coding style
From: Helge Deller @ 2025-07-27 18:00 UTC (permalink / raw)
To: Darshan R.; +Cc: linux-fbdev, dri-devel
In-Reply-To: <20250721125648.27179-1-rathod.darshan.0896@gmail.com>
On 7/21/25 14:56, Darshan R. wrote:
> This patch addresses various coding style issues in `svgalib.c` to improve readability and better align the code with the Linux kernel's formatting standards.
>
> The changes primarily consist of:
> - Adjusting whitespace around operators and after keywords.
> - Standardizing brace placement for control flow statements.
> - Removing unnecessary braces on single-statement if/else blocks.
> - Deleting extraneous blank lines throughout the file.
>
> These changes are purely stylistic and introduce no functional modifications.
>
> Signed-off-by: Darshan R. <rathod.darshan.0896@gmail.com>
> ---
> drivers/video/fbdev/core/svgalib.c | 95 +++++++++++++-----------------
> 1 file changed, 42 insertions(+), 53 deletions(-)
applied.
Thanks!
Helge
^ permalink raw reply
* Re: [PATCH v3 0/3] fbdev: kyro: Convert to managed device resources
From: Helge Deller @ 2025-07-27 17:57 UTC (permalink / raw)
To: Giovanni Di Santi, tzimmermann; +Cc: linux-fbdev, dri-devel, linux-kernel
In-Reply-To: <20250709095354.931589-1-giovanni.disanti.lkl@gmail.com>
On 7/9/25 11:53, Giovanni Di Santi wrote:
> This series aims to address the TODO item "Request memory regions in all
> fbdev drivers" from Documentation/gpu/todo.rst.
> Additionally, it also converts the kyro framebuffer driver to use managed device
> functions.
>
> In summary, it converts the driver to use:
> 1. Managed PCI device enable and region request functions
> 2. Managed ioremap for MMIO registers
> 3. Managed ioremap_wc for screen memory
>
> This simplifies error handling and removes the need for manual cleanup
> in the remove function.
>
> Changes in v3:
> - Split into a patch series as suggested by Thomas Zimmermann [1]
> - Convert ioremap calls to devm_ variants
>
> Changes in v2:
> - Use pcim_enable_device() instead of pci_enable_device()
> - Use pcim_request_all_regions() instead of pci_request_regions()
> - Removed manual cleanup code as it's now automatic
>
> [1] https://lore.kernel.org/lkml/fd6403d7-93f4-4fa4-ad0d-3ab91cba8183@suse.de/
>
> Giovanni Di Santi (3):
> fbdev: kyro: Add missing PCI memory region request
> fbdev: kyro: Use devm_ioremap() for mmio registers
> fbdev: kyro: Use devm_ioremap_wc() for screen mem
>
> drivers/video/fbdev/kyro/fbdev.c | 24 ++++++++++++------------
> 1 file changed, 12 insertions(+), 12 deletions(-)
series applied to fbdev git tree.
Thanks!
Helge
^ permalink raw reply
* Re: [PATCH] fbdev: simplefb: Use of_reserved_mem_region_to_resource() for "memory-region"
From: Helge Deller @ 2025-07-27 17:53 UTC (permalink / raw)
To: Rob Herring (Arm), Hans de Goede; +Cc: linux-fbdev, dri-devel, linux-kernel
In-Reply-To: <20250703183514.2074928-1-robh@kernel.org>
On 7/3/25 20:35, Rob Herring (Arm) wrote:
> Use the newly added of_reserved_mem_region_to_resource() function to
> handle "memory-region" properties.
>
> The error handling is a bit different. "memory-region" is optional, so
> failed lookup is not an error. But then an error in
> of_address_to_resource() is treated as an error. However, that
> distinction is not really important. Either the region is available
> and usable or it is not. So now, it is just
> of_reserved_mem_region_to_resource() which is checked for an error.
>
> Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
> ---
> drivers/video/fbdev/simplefb.c | 17 ++++-------------
> 1 file changed, 4 insertions(+), 13 deletions(-
applied.
Thanks!
Helge
^ permalink raw reply
* Re: [PATCH] fbdev: fix potential buffer overflow in do_register_framebuffer()
From: Helge Deller @ 2025-07-27 17:43 UTC (permalink / raw)
To: Yongzhen Zhang; +Cc: linux-fbdev
In-Reply-To: <20250701090704.161165-1-zhangyongzhen@kylinos.cn>
On 7/1/25 11:07, Yongzhen Zhang wrote:
> The current implementation may lead to buffer overflow when:
> 1. Unregistration creates NULL gaps in registered_fb[]
> 2. All array slots become occupied despite num_registered_fb < FB_MAX
> 3. The registration loop exceeds array bounds
>
> Add boundary check to prevent registered_fb[FB_MAX] access.
>
> Signed-off-by: Yongzhen Zhang <zhangyongzhen@kylinos.cn>
> ---
> drivers/video/fbdev/core/fbmem.c | 3 +++
> 1 file changed, 3 insertions(+)
applied.
Thanks!
Helge
^ permalink raw reply
* Re: [PATCH] fbdev: nvidiafb: add depends on HAS_IOPORT
From: Helge Deller @ 2025-07-27 17:28 UTC (permalink / raw)
To: Randy Dunlap, linux-kernel
Cc: Arnd Bergmann, Niklas Schnelle, Antonino Daplas, linux-fbdev,
dri-devel
In-Reply-To: <20250615183651.902092-1-rdunlap@infradead.org>
On 6/15/25 20:36, Randy Dunlap wrote:
> The nvidiafb driver uses inb()/outb() without depending on HAS_IOPORT,
> which leads to build errors since kernel v6.13-rc1:
> commit 6f043e757445 ("asm-generic/io.h: Remove I/O port accessors
> for HAS_IOPORT=n")
>
> Add the HAS_IOPORT dependency to prevent the build errors.
>
> (Found in ARCH=um allmodconfig builds)
>
> drivers/video/fbdev/nvidia/nv_accel.c: In function ‘NVDmaWait’:
> include/asm-generic/io.h:596:15: error: call to ‘_outb’ declared with attribute error: outb() requires CONFIG_HAS_IOPORT
> 596 | #define _outb _outb
>
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> Cc: Arnd Bergmann <arnd@kernel.org>
> Cc: Niklas Schnelle <schnelle@linux.ibm.com>
> Cc: Antonino Daplas <adaplas@gmail.com>
> Cc: Helge Deller <deller@gmx.de>
> Cc: linux-fbdev@vger.kernel.org
> Cc: dri-devel@lists.freedesktop.org
> ---
> drivers/video/fbdev/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
applied.
Thanks!
Helge
>
> --- lnx-616-rc1.orig/drivers/video/fbdev/Kconfig
> +++ lnx-616-rc1/drivers/video/fbdev/Kconfig
> @@ -660,7 +660,7 @@ config FB_ATMEL
>
> config FB_NVIDIA
> tristate "nVidia Framebuffer Support"
> - depends on FB && PCI
> + depends on FB && PCI && HAS_IOPORT
> select FB_CFB_FILLRECT
> select FB_CFB_COPYAREA
> select FB_CFB_IMAGEBLIT
> ---
> base-commit: 19272b37aa4f83ca52bdf9c16d5d81bdd1354494 # v6.16-rc1
^ permalink raw reply
* Re: [PATCH 2/4] backlight: add max25014atg backlight
From: kernel test robot @ 2025-07-26 21:50 UTC (permalink / raw)
To: Maud Spierings via B4 Relay, Lee Jones, Daniel Thompson,
Jingoo Han, Pavel Machek, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Helge Deller, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam
Cc: llvm, oe-kbuild-all, dri-devel, linux-leds, devicetree,
linux-kernel, linux-fbdev, imx, linux-arm-kernel, Maud Spierings,
MaudSpieringsmaudspierings
In-Reply-To: <20250725-max25014-v1-2-0e8cce92078e@gocontroll.com>
Hi Maud,
kernel test robot noticed the following build warnings:
[auto build test WARNING on d7af19298454ed155f5cf67201a70f5cf836c842]
url: https://github.com/intel-lab-lkp/linux/commits/Maud-Spierings-via-B4-Relay/dt-bindings-backlight-Add-max25014-bindings/20250725-191221
base: d7af19298454ed155f5cf67201a70f5cf836c842
patch link: https://lore.kernel.org/r/20250725-max25014-v1-2-0e8cce92078e%40gocontroll.com
patch subject: [PATCH 2/4] backlight: add max25014atg backlight
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20250727/202507270543.G0TT6f25-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250727/202507270543.G0TT6f25-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202507270543.G0TT6f25-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/video/backlight/max25014.c:86:4: warning: variable 'res' is uninitialized when used here [-Wuninitialized]
86 | res |= 1 << i;
| ^~~
drivers/video/backlight/max25014.c:82:13: note: initialize the variable 'res' to silence this warning
82 | uint8_t res, i;
| ^
| = '\0'
1 warning generated.
vim +/res +86 drivers/video/backlight/max25014.c
73
74 /**
75 * @brief get the bit mask for the DISABLE register.
76 *
77 * @param strings the led string configuration array.
78 * @return uint8_t bits to set in the register.
79 */
80 static uint8_t strings_mask(struct max25014 *maxim)
81 {
82 uint8_t res, i;
83
84 for (i = 0; i < 4; i++) {
85 if (maxim->pdata->strings[i] == 0)
> 86 res |= 1 << i;
87 }
88 return res;
89 }
90
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply
* Re: [PATCH] staging: fbtft: add support for a device tree of backlight.
From: Greg KH @ 2025-07-26 6:31 UTC (permalink / raw)
To: chalianis1; +Cc: andy, linux-staging, linux-fbdev, stable
In-Reply-To: <20250726000416.23960-1-chalianis1@gmail.com>
On Fri, Jul 25, 2025 at 08:04:16PM -0400, chalianis1@gmail.com wrote:
> From: Chali Anis <chalianis1@gmail.com>
>
> Support the of backlight from device tree and keep compatibility
> for the legacy gpio backlight.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Chali Anis <chalianis1@gmail.com>
> ---
> drivers/staging/fbtft/fbtft-core.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
> index da9c64152a60..5f0220dbe397 100644
> --- a/drivers/staging/fbtft/fbtft-core.c
> +++ b/drivers/staging/fbtft/fbtft-core.c
> @@ -170,6 +170,18 @@ void fbtft_register_backlight(struct fbtft_par *par)
> struct backlight_device *bd;
> struct backlight_properties bl_props = { 0, };
>
> + bd = devm_of_find_backlight(par->info->device);
> + if (IS_ERR(bd)) {
> + dev_warn(par->info->device,
> + "cannot find of backlight device (%ld), trying legacy\n",
> + PTR_ERR(bd));
So now you are going to get a warning message for a system that
previously did not at all? That's not very nice to those users :(
^ permalink raw reply
* [PATCH] staging: fbtft: add support for a device tree of backlight.
From: chalianis1 @ 2025-07-26 0:04 UTC (permalink / raw)
To: andy; +Cc: linux-staging, linux-fbdev, stable, gregkh, Chali Anis
From: Chali Anis <chalianis1@gmail.com>
Support the of backlight from device tree and keep compatibility
for the legacy gpio backlight.
Cc: stable@vger.kernel.org
Signed-off-by: Chali Anis <chalianis1@gmail.com>
---
drivers/staging/fbtft/fbtft-core.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
index da9c64152a60..5f0220dbe397 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -170,6 +170,18 @@ void fbtft_register_backlight(struct fbtft_par *par)
struct backlight_device *bd;
struct backlight_properties bl_props = { 0, };
+ bd = devm_of_find_backlight(par->info->device);
+ if (IS_ERR(bd)) {
+ dev_warn(par->info->device,
+ "cannot find of backlight device (%ld), trying legacy\n",
+ PTR_ERR(bd));
+ }
+
+ if (bd) {
+ par->info->bl_dev = bd;
+ return;
+ }
+
if (!par->gpio.led[0]) {
fbtft_par_dbg(DEBUG_BACKLIGHT, par,
"%s(): led pin not set, exiting.\n", __func__);
--
2.34.1
^ permalink raw reply related
* Re: [PATCH 1/4] dt-bindings: backlight: Add max25014 bindings
From: Rob Herring @ 2025-07-25 19:51 UTC (permalink / raw)
To: Maud Spierings
Cc: Shawn Guo, Jingoo Han, devicetree, linux-kernel, Daniel Thompson,
Helge Deller, linux-fbdev, Lee Jones, Fabio Estevam,
Krzysztof Kozlowski, Sascha Hauer, dri-devel, linux-leds,
Pavel Machek, Pengutronix Kernel Team, imx, linux-arm-kernel,
Conor Dooley
In-Reply-To: <03096180-1e33-4dd0-b027-cc18a5010e46@gocontroll.com>
On Fri, Jul 25, 2025 at 04:06:45PM +0200, Maud Spierings wrote:
>
>
> On 7/25/25 15:27, Rob Herring (Arm) wrote:
> >
> > On Fri, 25 Jul 2025 13:09:23 +0200, Maud Spierings wrote:
> > > The Maxim MAX25014 is a 4-channel automotive grade backlight driver IC
> > > with intgrated boost controller.
> > >
> > > Signed-off-by: Maud Spierings <maudspierings@gocontroll.com>
> > > ---
> > > .../bindings/leds/backlight/maxim,max25014.yaml | 78 ++++++++++++++++++++++
> > > MAINTAINERS | 5 ++
> > > 2 files changed, 83 insertions(+)
> > >
> >
> > My bot found errors running 'make dt_binding_check' on your patch:
>
> Pretty sure I did that, but I've never gotten those tools to work quite
> right, I'll look at it for v2
What's the issue?
Rob
^ permalink raw reply
* Re: [PATCH 1/4] dt-bindings: backlight: Add max25014 bindings
From: Maud Spierings @ 2025-07-25 14:06 UTC (permalink / raw)
To: Rob Herring (Arm)
Cc: Shawn Guo, Jingoo Han, devicetree, linux-kernel, Daniel Thompson,
Helge Deller, linux-fbdev, Lee Jones, Fabio Estevam,
Krzysztof Kozlowski, Sascha Hauer, dri-devel, linux-leds,
Pavel Machek, Pengutronix Kernel Team, imx, linux-arm-kernel,
Conor Dooley
In-Reply-To: <175345006903.1002291.4212198267952446360.robh@kernel.org>
On 7/25/25 15:27, Rob Herring (Arm) wrote:
>
> On Fri, 25 Jul 2025 13:09:23 +0200, Maud Spierings wrote:
>> The Maxim MAX25014 is a 4-channel automotive grade backlight driver IC
>> with intgrated boost controller.
>>
>> Signed-off-by: Maud Spierings <maudspierings@gocontroll.com>
>> ---
>> .../bindings/leds/backlight/maxim,max25014.yaml | 78 ++++++++++++++++++++++
>> MAINTAINERS | 5 ++
>> 2 files changed, 83 insertions(+)
>>
>
> My bot found errors running 'make dt_binding_check' on your patch:
Pretty sure I did that, but I've never gotten those tools to work quite
right, I'll look at it for v2
> yamllint warnings/errors:
>
> dtschema/dtc warnings/errors:
> /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/backlight/maxim,max25014.example.dtb: backlight@6f (maxim,max25014): Unevaluated properties are not allowed ('bl-name' was unexpected)
> from schema $id: http://devicetree.org/schemas/leds/backlight/maxim,max25014.yaml#
Ah oops, leftover from old version, fixed in rv2
> doc reference errors (make refcheckdocs):
>
> See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20250725-max25014-v1-1-0e8cce92078e@gocontroll.com
>
> The base for the series is generally the latest rc1. A different dependency
> should be noted in *this* patch.
>
> If you already ran 'make dt_binding_check' and didn't see the above
> error(s), then make sure 'yamllint' is installed and dt-schema is up to
> date:
>
> pip3 install dtschema --upgrade
>
> Please check and re-submit after running the above command yourself. Note
> that DT_SCHEMA_FILES can be set to your schema file to speed up checking
> your schema. However, it must be unset to test all examples with your schema.
>
Kind Regards,
Maud
^ permalink raw reply
* Re: [PATCH 1/4] dt-bindings: backlight: Add max25014 bindings
From: Rob Herring (Arm) @ 2025-07-25 13:27 UTC (permalink / raw)
To: Maud Spierings
Cc: Shawn Guo, Jingoo Han, devicetree, linux-kernel, Daniel Thompson,
Helge Deller, linux-fbdev, Lee Jones, Fabio Estevam,
Krzysztof Kozlowski, Sascha Hauer, dri-devel, linux-leds,
Pavel Machek, Pengutronix Kernel Team, imx, linux-arm-kernel,
Conor Dooley
In-Reply-To: <20250725-max25014-v1-1-0e8cce92078e@gocontroll.com>
On Fri, 25 Jul 2025 13:09:23 +0200, Maud Spierings wrote:
> The Maxim MAX25014 is a 4-channel automotive grade backlight driver IC
> with intgrated boost controller.
>
> Signed-off-by: Maud Spierings <maudspierings@gocontroll.com>
> ---
> .../bindings/leds/backlight/maxim,max25014.yaml | 78 ++++++++++++++++++++++
> MAINTAINERS | 5 ++
> 2 files changed, 83 insertions(+)
>
My bot found errors running 'make dt_binding_check' on your patch:
yamllint warnings/errors:
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/leds/backlight/maxim,max25014.example.dtb: backlight@6f (maxim,max25014): Unevaluated properties are not allowed ('bl-name' was unexpected)
from schema $id: http://devicetree.org/schemas/leds/backlight/maxim,max25014.yaml#
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20250725-max25014-v1-1-0e8cce92078e@gocontroll.com
The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
^ permalink raw reply
* [PATCH 4/4] arm64: dts: freescale: moduline-display-av123z7m-n17: add backlight
From: Maud Spierings via B4 Relay @ 2025-07-25 11:09 UTC (permalink / raw)
To: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Helge Deller, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam
Cc: dri-devel, linux-leds, devicetree, linux-kernel, linux-fbdev, imx,
linux-arm-kernel, Maud Spierings
In-Reply-To: <20250725-max25014-v1-0-0e8cce92078e@gocontroll.com>
From: Maud Spierings <maudspierings@gocontroll.com>
Add the missing backlight.
Signed-off-by: Maud Spierings <maudspierings@gocontroll.com>
---
...p-tx8p-ml81-moduline-display-106-av123z7m-n17.dtso | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/freescale/imx8mp-tx8p-ml81-moduline-display-106-av123z7m-n17.dtso b/arch/arm64/boot/dts/freescale/imx8mp-tx8p-ml81-moduline-display-106-av123z7m-n17.dtso
index 3eb665ce9d5d2a1c742ffb4feca046e406e29956..9124cd87cce54a5aa7b7ad674f70f814d1dc3515 100644
--- a/arch/arm64/boot/dts/freescale/imx8mp-tx8p-ml81-moduline-display-106-av123z7m-n17.dtso
+++ b/arch/arm64/boot/dts/freescale/imx8mp-tx8p-ml81-moduline-display-106-av123z7m-n17.dtso
@@ -16,6 +16,7 @@
panel {
compatible = "boe,av123z7m-n17";
+ backlight = <&backlight>;
enable-gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
pinctrl-0 = <&pinctrl_panel>;
pinctrl-names = "default";
@@ -91,10 +92,26 @@ lvds1_out: endpoint {
};
};
- /* max25014 @ 0x6f */
+ backlight: backlight@6f {
+ reg = <0x6f>;
+ compatible = "maxim,max25014";
+ default-brightness = <50>;
+ enable-gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_backlight>;
+ maxim,iset = <7>;
+ maxim,strings = <1 1 1 1>;
+ };
};
&iomuxc {
+ pinctrl_backlight: backlightgrp {
+ fsl,pins = <
+ MX8MP_IOMUXC_GPIO1_IO04__GPIO1_IO04
+ (MX8MP_PULL_UP | MX8MP_PULL_ENABLE)
+ >;
+ };
+
pinctrl_lvds_bridge: lvdsbridgegrp {
fsl,pins = <
MX8MP_IOMUXC_SAI1_TXD2__GPIO4_IO14
--
2.50.1
^ permalink raw reply related
* [PATCH 3/4] arm64: dts: freescale: moduline-display-av101hdt-a10: add backlight
From: Maud Spierings via B4 Relay @ 2025-07-25 11:09 UTC (permalink / raw)
To: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Helge Deller, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam
Cc: dri-devel, linux-leds, devicetree, linux-kernel, linux-fbdev, imx,
linux-arm-kernel, Maud Spierings
In-Reply-To: <20250725-max25014-v1-0-0e8cce92078e@gocontroll.com>
From: Maud Spierings <maudspierings@gocontroll.com>
Add the missing backlight driver.
Signed-off-by: Maud Spierings <maudspierings@gocontroll.com>
---
...tx8p-ml81-moduline-display-106-av101hdt-a10.dtso | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/arch/arm64/boot/dts/freescale/imx8mp-tx8p-ml81-moduline-display-106-av101hdt-a10.dtso b/arch/arm64/boot/dts/freescale/imx8mp-tx8p-ml81-moduline-display-106-av101hdt-a10.dtso
index e3965caca6be42a17aa89b77bd5b919382c84151..143243ba95cd7a69c7b043fa0fb32c37b67e1064 100644
--- a/arch/arm64/boot/dts/freescale/imx8mp-tx8p-ml81-moduline-display-106-av101hdt-a10.dtso
+++ b/arch/arm64/boot/dts/freescale/imx8mp-tx8p-ml81-moduline-display-106-av101hdt-a10.dtso
@@ -17,6 +17,7 @@
panel {
compatible = "boe,av101hdt-a10";
+ backlight = <&backlight>;
enable-gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>;
pinctrl-0 = <&pinctrl_panel>;
pinctrl-names = "default";
@@ -40,7 +41,27 @@ reg_vbus: regulator-vbus {
};
};
+&i2c4 {
+ backlight: backlight@6f {
+ reg = <0x6f>;
+ compatible = "maxim,max25014";
+ default-brightness = <50>;
+ enable-gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_backlight>;
+ maxim,iset = <7>;
+ maxim,strings = <1 1 1 0>;
+ };
+};
+
&iomuxc {
+ pinctrl_backlight: backlightgrp {
+ fsl,pins = <
+ MX8MP_IOMUXC_GPIO1_IO04__GPIO1_IO04
+ (MX8MP_PULL_UP | MX8MP_PULL_ENABLE)
+ >;
+ };
+
pinctrl_panel: panelgrp {
fsl,pins = <
MX8MP_IOMUXC_GPIO1_IO07__GPIO1_IO07
--
2.50.1
^ permalink raw reply related
* [PATCH 1/4] dt-bindings: backlight: Add max25014 bindings
From: Maud Spierings via B4 Relay @ 2025-07-25 11:09 UTC (permalink / raw)
To: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Helge Deller, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam
Cc: dri-devel, linux-leds, devicetree, linux-kernel, linux-fbdev, imx,
linux-arm-kernel, Maud Spierings
In-Reply-To: <20250725-max25014-v1-0-0e8cce92078e@gocontroll.com>
From: Maud Spierings <maudspierings@gocontroll.com>
The Maxim MAX25014 is a 4-channel automotive grade backlight driver IC
with intgrated boost controller.
Signed-off-by: Maud Spierings <maudspierings@gocontroll.com>
---
.../bindings/leds/backlight/maxim,max25014.yaml | 78 ++++++++++++++++++++++
MAINTAINERS | 5 ++
2 files changed, 83 insertions(+)
diff --git a/Documentation/devicetree/bindings/leds/backlight/maxim,max25014.yaml b/Documentation/devicetree/bindings/leds/backlight/maxim,max25014.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..63baf1cbcbb14ed93d7e45ba013080872060ce71
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/backlight/maxim,max25014.yaml
@@ -0,0 +1,78 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/backlight/maxim,max25014.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Maxim max25014 backlight controller
+
+maintainers:
+ - Maud Spierings <maudspierings@gocontroll.com>
+
+allOf:
+ - $ref: common.yaml#
+
+properties:
+ compatible:
+ enum:
+ - maxim,max25014
+
+ reg:
+ maxItems: 1
+
+ enable-gpios:
+ maxItems: 1
+
+ interrupts:
+ maxItems: 1
+
+ power-supply:
+ description: Regulator which controls the boost converter input rail.
+
+ pwms:
+ maxItems: 1
+
+ maxim,iset:
+ $ref: /schemas/types.yaml#/definitions/uint32
+ default: 11
+ description:
+ Value of the ISET register field (0-15). Default is 11.
+
+ maxim,strings:
+ $ref: /schemas/types.yaml#/definitions/uint32-array
+ description:
+ A 4-bit bitfield that describes which led strings to turn on.
+ minItems: 4
+ maxItems: 4
+
+required:
+ - compatible
+ - reg
+ - maxim,strings
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/gpio/gpio.h>
+ #include <dt-bindings/interrupt-controller/irq.h>
+
+ i2c {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ backlight: backlight@6f {
+ reg = <0x6f>;
+ compatible = "maxim,max25014";
+ bl-name = "max25014";
+ default-brightness = <50>;
+ enable-gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>;
+ interrupt-parent = <&gpio1>;
+ interrupts = <2 IRQ_TYPE_EDGE_FALLING>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_backlight>;
+ maxim,iset = <7>;
+ maxim,strings = <1 1 1 1>;
+ };
+ };
+
diff --git a/MAINTAINERS b/MAINTAINERS
index 5e18349a5556e4d793b63a6b3c600000b21b0418..9e9a45442b7bf60b00eaf3f8ebadf8f4fbaf3bef 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -14907,6 +14907,11 @@ F: Documentation/userspace-api/media/drivers/max2175.rst
F: drivers/media/i2c/max2175*
F: include/uapi/linux/max2175.h
+MAX25014 BACKLIGHT DRIVER
+M: Maud Spierings <maudspierings@gocontroll.com>
+S: Maintained
+F: Documentation/devicetree/bindings/leds/backlight/maxim,max25014.yaml
+
MAX31335 RTC DRIVER
M: Antoniu Miclaus <antoniu.miclaus@analog.com>
L: linux-rtc@vger.kernel.org
--
2.50.1
^ permalink raw reply related
* [PATCH 2/4] backlight: add max25014atg backlight
From: Maud Spierings via B4 Relay @ 2025-07-25 11:09 UTC (permalink / raw)
To: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Helge Deller, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam
Cc: dri-devel, linux-leds, devicetree, linux-kernel, linux-fbdev, imx,
linux-arm-kernel, Maud Spierings,
"Maud Spierings maudspierings"
In-Reply-To: <20250725-max25014-v1-0-0e8cce92078e@gocontroll.com>
From: Maud Spierings <maudspierings@gocontroll.com>
The Maxim MAX25014 is a 4-channel automotive grade backlight driver IC
with intgrated boost controller.
Signed-off-by: Maud Spierings maudspierings@gocontroll.com
---
MAINTAINERS | 2 +
drivers/video/backlight/Kconfig | 7 +
drivers/video/backlight/Makefile | 1 +
drivers/video/backlight/max25014.c | 449 +++++++++++++++++++++++++++++++++
include/linux/platform_data/max25014.h | 24 ++
5 files changed, 483 insertions(+)
diff --git a/MAINTAINERS b/MAINTAINERS
index 9e9a45442b7bf60b00eaf3f8ebadf8f4fbaf3bef..3cae3402f531921a93208626ba9477018e7ef347 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -14911,6 +14911,8 @@ MAX25014 BACKLIGHT DRIVER
M: Maud Spierings <maudspierings@gocontroll.com>
S: Maintained
F: Documentation/devicetree/bindings/leds/backlight/maxim,max25014.yaml
+F: drivers/video/backlight/max25014.c
+F: include/linux/platform_data/max25014.h
MAX31335 RTC DRIVER
M: Antoniu Miclaus <antoniu.miclaus@analog.com>
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index d9374d208ceebbf8b3c27976e9cb4d725939b942..d3bb6ccd41853d940f24c6ab8135e4b9b9ebefd7 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -262,6 +262,13 @@ config BACKLIGHT_DA9052
help
Enable the Backlight Driver for DA9052-BC and DA9053-AA/Bx PMICs.
+config BACKLIGHT_MAX25014
+ tristate "Backlight driver for the Maxim MAX25014 chip"
+ depends on I2C
+ select REGMAP_I2C
+ help
+ If you are using a MAX25014 chip as a backlight driver say Y to enable it.
+
config BACKLIGHT_MAX8925
tristate "Backlight driver for MAX8925"
depends on MFD_MAX8925
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index dfbb169bf6ea215704859f633b6c4a887f4ebacd..1170d9ec40b8dbd52aeec1dade1cd2d2b56af466 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -45,6 +45,7 @@ obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o
obj-$(CONFIG_BACKLIGHT_LP855X) += lp855x_bl.o
obj-$(CONFIG_BACKLIGHT_LP8788) += lp8788_bl.o
obj-$(CONFIG_BACKLIGHT_LV5207LP) += lv5207lp.o
+obj-$(CONFIG_BACKLIGHT_MAX25014) += max25014.o
obj-$(CONFIG_BACKLIGHT_MAX8925) += max8925_bl.o
obj-$(CONFIG_BACKLIGHT_MP3309C) += mp3309c.o
obj-$(CONFIG_BACKLIGHT_MT6370) += mt6370-backlight.o
diff --git a/drivers/video/backlight/max25014.c b/drivers/video/backlight/max25014.c
new file mode 100644
index 0000000000000000000000000000000000000000..371b6017953ae5955f4dfef921980dfdedd65d85
--- /dev/null
+++ b/drivers/video/backlight/max25014.c
@@ -0,0 +1,449 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Backlight driver for Maxim MAX25014
+ *
+ * Copyright (C) 2025 GOcontroll B.V.
+ * Author: Maud Spierings <maudspierings@gocontroll.com>
+ */
+
+#include <linux/backlight.h>
+#include <linux/gpio/consumer.h>
+#include <linux/i2c.h>
+#include <linux/platform_data/max25014.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+
+#define MAX25014_ISET_DEFAULT_100 11U
+#define MAX_BRIGHTNESS (100U)
+#define MIN_BRIGHTNESS (0U)
+#define TON_MAX (130720U) /* @153Hz */
+#define TON_STEP (1307U) /* @153Hz */
+#define TON_MIN (0U)
+
+#define MAX25014_DEV_ID (0x00U)
+#define MAX25014_REV_ID (0x01U)
+#define MAX25014_ISET (0x02U)
+#define MAX25014_IMODE (0x03U)
+#define MAX25014_TON1H (0x04U)
+#define MAX25014_TON1L (0x05U)
+#define MAX25014_TON2H (0x06U)
+#define MAX25014_TON2L (0x07U)
+#define MAX25014_TON3H (0x08U)
+#define MAX25014_TON3L (0x09U)
+#define MAX25014_TON4H (0x0AU)
+#define MAX25014_TON4L (0x0BU)
+#define MAX25014_TON_1_4_LSB (0x0CU)
+#define MAX25014_SETTING (0x12U)
+#define MAX25014_DISABLE (0x13U)
+#define MAX25014_BSTMON (0x14U)
+#define MAX25014_IOUT1 (0x15U)
+#define MAX25014_IOUT2 (0x16U)
+#define MAX25014_IOUT3 (0x17U)
+#define MAX25014_IOUT4 (0x18U)
+#define MAX25014_OPEN (0x1BU)
+#define MAX25014_SHORT_GND (0x1CU)
+#define MAX25014_SHORT_LED (0x1DU)
+#define MAX25014_MASK (0x1EU)
+#define MAX25014_DIAG (0x1FU)
+
+#define MAX25014_IMODE_HDIM BIT(2)
+#define MAX25014_ISET_ENABLE BIT(5)
+#define MAX25014_ISET_PSEN BIT(4)
+#define MAX25014_DIAG_HW_RST BIT(2)
+#define MAX25014_SETTING_FPWM GENMASK(6, 4)
+
+struct max25014;
+
+struct max25014 {
+ const char *chipname;
+ struct i2c_client *client;
+ struct backlight_device *bl;
+ struct device *dev;
+ struct regmap *regmap;
+ struct max25014_platform_data *pdata;
+ struct gpio_desc *enable;
+ struct regulator *vin; /* regulator for boost converter Vin rail */
+};
+
+static const struct regmap_config max25014_regmap_config = {
+ .reg_bits = 8,
+ .val_bits = 8,
+ .max_register = MAX25014_DIAG,
+};
+
+/**
+ * @brief get the bit mask for the DISABLE register.
+ *
+ * @param strings the led string configuration array.
+ * @return uint8_t bits to set in the register.
+ */
+static uint8_t strings_mask(struct max25014 *maxim)
+{
+ uint8_t res, i;
+
+ for (i = 0; i < 4; i++) {
+ if (maxim->pdata->strings[i] == 0)
+ res |= 1 << i;
+ }
+ return res;
+}
+
+/**
+ * @brief control the brightness with i2c registers
+ *
+ * @param regmap trivial
+ * @param brt brightness
+ * @return int
+ */
+static int max25014_register_control(struct regmap *regmap, uint32_t brt)
+{
+ uint32_t reg = TON_STEP * brt;
+ int ret;
+ /*
+ * 18 bit number lowest, 2 bits in first register,
+ * next lowest 8 in the L register, next 8 in the H register
+ * Seemingly setting the strength of only one string controls all of
+ * them, individual settings don't affect the outcome.
+ */
+
+ ret = regmap_write(regmap, MAX25014_TON_1_4_LSB, reg & 0b00000011);
+ if (ret != 0)
+ return ret;
+ ret = regmap_write(regmap, MAX25014_TON1L, (reg >> 2) & 0b11111111);
+ if (ret != 0)
+ return ret;
+ return regmap_write(regmap, MAX25014_TON1H, (reg >> 10) & 0b11111111);
+}
+
+static int max25014_check_errors(struct max25014 *maxim)
+{
+ uint8_t i;
+ int ret;
+ uint32_t val;
+
+ ret = regmap_read(maxim->regmap, MAX25014_OPEN, &val);
+ if (ret != 0)
+ return ret;
+ if (val > 0) {
+ dev_err(maxim->dev, "Open led strings detected on:\n");
+ for (i = 0; i < 4; i++) {
+ if (val & 1 << i)
+ dev_err(maxim->dev, "string %d\n", i + 1);
+ }
+ return -EIO;
+ }
+
+ ret = regmap_read(maxim->regmap, MAX25014_SHORT_GND, &val);
+ if (ret != 0)
+ return ret;
+ if (val > 0) {
+ dev_err(maxim->dev, "Short to ground detected on:\n");
+ for (i = 0; i < 4; i++) {
+ if (val & 1 << i)
+ dev_err(maxim->dev, "string %d\n", i + 1);
+ }
+ return -EIO;
+ }
+
+ ret = regmap_read(maxim->regmap, MAX25014_SHORT_GND, &val);
+ if (ret != 0)
+ return ret;
+ if (val > 0) {
+ dev_err(maxim->dev, "Shorted led detected on:\n");
+ for (i = 0; i < 4; i++) {
+ if (val & 1 << i)
+ dev_err(maxim->dev, "string %d\n", i + 1);
+ }
+ return -EIO;
+ }
+
+ ret = regmap_read(maxim->regmap, MAX25014_DIAG, &val);
+ if (ret != 0)
+ return ret;
+ /*
+ * The HW_RST bit always starts at 1 after power up.
+ * It is reset on first read, does not indicate an error.
+ */
+ if (val > 0 && val != MAX25014_DIAG_HW_RST) {
+ if (val & 0b1)
+ dev_err(maxim->dev, "Overtemperature shutdown\n");
+ if (val & 0b10)
+ dev_warn(maxim->dev,
+ "Chip is getting too hot (>125C)\n");
+ if (val & 0b1000)
+ dev_err(maxim->dev, "Boost converter overvoltage\n");
+ if (val & 0b10000)
+ dev_err(maxim->dev, "Boost converter undervoltage\n");
+ if (val & 0b100000)
+ dev_err(maxim->dev, "IREF out of range\n");
+ return -EIO;
+ }
+ return 0;
+}
+
+/*
+ * 1. disable unused strings
+ * 2. set dim mode
+ * 3. set initial brightness
+ * 4. set setting register
+ * 5. enable the backlight
+ */
+static int max25014_configure(struct max25014 *maxim)
+{
+ int ret;
+ uint32_t val;
+
+ ret = regmap_write(maxim->regmap, MAX25014_DISABLE,
+ strings_mask(maxim));
+ if (ret != 0)
+ return ret;
+
+ ret = regmap_write(maxim->regmap, MAX25014_IMODE, MAX25014_IMODE_HDIM);
+ if (ret != 0)
+ return ret;
+
+ max25014_register_control(maxim->regmap,
+ maxim->pdata->initial_brightness);
+
+ ret = regmap_read(maxim->regmap, MAX25014_SETTING, &val);
+ if (ret != 0)
+ return ret;
+
+ ret = regmap_write(
+ maxim->regmap, MAX25014_SETTING,
+ val & ~MAX25014_SETTING_FPWM);
+ if (ret != 0)
+ return ret;
+
+ ret = regmap_write(maxim->regmap, MAX25014_ISET,
+ maxim->pdata->iset | MAX25014_ISET_ENABLE | MAX25014_ISET_PSEN);
+ return ret;
+}
+
+static int max25014_update_status(struct backlight_device *bl_dev)
+{
+ struct max25014 *maxim = bl_get_data(bl_dev);
+
+ if (bl_dev->props.state & BL_CORE_SUSPENDED)
+ bl_dev->props.brightness = 0;
+
+ return max25014_register_control(maxim->regmap, bl_dev->props.brightness);
+}
+
+static const struct backlight_ops max25014_bl_ops = {
+ .options = BL_CORE_SUSPENDRESUME,
+ .update_status = max25014_update_status,
+};
+
+static int max25014_backlight_register(struct max25014 *maxim)
+{
+ struct backlight_device *bl;
+ struct backlight_properties props;
+ struct max25014_platform_data *pdata = maxim->pdata;
+
+ memset(&props, 0, sizeof(props));
+ props.type = BACKLIGHT_PLATFORM;
+ props.max_brightness = MAX_BRIGHTNESS;
+
+ if (pdata->initial_brightness > props.max_brightness)
+ pdata->initial_brightness = props.max_brightness;
+
+ props.brightness = pdata->initial_brightness;
+
+ bl = devm_backlight_device_register(maxim->dev, maxim->chipname, maxim->dev,
+ maxim, &max25014_bl_ops, &props);
+ if (IS_ERR(bl))
+ return PTR_ERR(bl);
+
+ maxim->bl = bl;
+
+ return 0;
+}
+
+#ifdef CONFIG_OF
+static int max25014_parse_dt(struct max25014 *maxim)
+{
+ struct device *dev = maxim->dev;
+ struct device_node *node = dev->of_node;
+ struct max25014_platform_data *pdata;
+
+ int res;
+
+ if (!node) {
+ dev_err(dev, "no platform data\n");
+ return -EINVAL;
+ }
+
+ pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
+ if (!pdata)
+ return -ENOMEM;
+
+ res = of_property_count_u32_elems(node, "maxim,strings");
+ if (res == 4) {
+ of_property_read_u32_array(node, "maxim,strings", pdata->strings, 4);
+ } else {
+ dev_err(dev, "strings property not correctly defined\n");
+ return -EINVAL;
+ }
+
+ pdata->initial_brightness = 50U;
+ of_property_read_u32(node, "default-brightness", &pdata->initial_brightness);
+ pdata->iset = MAX25014_ISET_DEFAULT_100;
+ of_property_read_u32(node, "maxim,iset", &pdata->iset);
+
+ if (pdata->iset < 0 || pdata->iset > 15) {
+ dev_err(dev,
+ "Invalid iset, should be a value from 0-15, entered was %d\n",
+ pdata->iset);
+ return -EINVAL;
+ }
+
+ if (pdata->initial_brightness < 0 || pdata->initial_brightness > 100) {
+ dev_err(dev,
+ "Invalid initial brightness, should be a value from 0-100, entered was %d\n",
+ pdata->initial_brightness);
+ return -EINVAL;
+ }
+
+ maxim->pdata = pdata;
+
+ return 0;
+}
+#else
+static int max25014_parse_dt(struct max25014 *maxim)
+{
+ dev_err(maxim->dev,
+ "CONFIG_OF not configured, unable to parse devicetree");
+ return -EINVAL;
+}
+#endif
+
+static int max25014_probe(struct i2c_client *cl)
+{
+ const struct i2c_device_id *id = i2c_client_get_device_id(cl);
+ struct max25014 *maxim;
+ int ret;
+
+ maxim = devm_kzalloc(&cl->dev, sizeof(struct max25014), GFP_KERNEL);
+ if (!maxim)
+ return -ENOMEM;
+
+ maxim->client = cl;
+ maxim->dev = &cl->dev;
+ maxim->chipname = id->name;
+ maxim->pdata = dev_get_platdata(&cl->dev);
+
+ if (!maxim->pdata) {
+ ret = max25014_parse_dt(maxim);
+ if (ret < 0)
+ return ret;
+ }
+
+ maxim->vin = devm_regulator_get(maxim->dev, "power");
+ if (IS_ERR(maxim->vin)) {
+ if (PTR_ERR(maxim->vin) == -EPROBE_DEFER)
+ return -EPROBE_DEFER;
+ maxim->vin = NULL;
+ }
+
+ if (maxim->vin) {
+ ret = regulator_enable(maxim->vin);
+ if (ret < 0) {
+ dev_err(maxim->dev, "failed to enable Vin: %d\n", ret);
+ return ret;
+ }
+ }
+
+ maxim->enable =
+ devm_gpiod_get_optional(maxim->dev, "enable", GPIOD_ASIS);
+ if (IS_ERR(maxim->enable)) {
+ ret = PTR_ERR(maxim->enable);
+ dev_err(maxim->dev, "failed to get enable gpio: %d\n", ret);
+ goto disable_vin;
+ }
+
+ if (maxim->enable) {
+ gpiod_set_value_cansleep(maxim->enable, 1);
+
+ /* Datasheet Electrical Characteristics tSTARTUP 2ms */
+ usleep_range(2000, 2500);
+ }
+
+ maxim->regmap = devm_regmap_init_i2c(cl, &max25014_regmap_config);
+ if (IS_ERR(maxim->regmap)) {
+ ret = PTR_ERR(maxim->regmap);
+ dev_err(maxim->dev, "failed to initialize the i2c regmap: %d\n", ret);
+ goto disable_full;
+ }
+
+ i2c_set_clientdata(cl, maxim);
+
+ ret = max25014_check_errors(maxim);
+ if (ret) { /* error is already reported in the above function */
+ goto disable_full;
+ }
+
+ ret = max25014_configure(maxim);
+ if (ret) {
+ dev_err(maxim->dev, "device config err: %d", ret);
+ goto disable_full;
+ }
+
+ ret = max25014_backlight_register(maxim);
+ if (ret) {
+ dev_err(maxim->dev, "failed to register backlight. err: %d\n",
+ ret);
+ goto disable_full;
+ }
+
+ dev_dbg(maxim->dev, "max25014 probed.\n");
+
+ return 0;
+
+disable_full:
+ if (maxim->enable)
+ gpiod_set_value_cansleep(maxim->enable, 0);
+disable_vin:
+ if (maxim->vin)
+ regulator_disable(maxim->vin);
+ return ret;
+}
+
+static void max25014_remove(struct i2c_client *cl)
+{
+ struct max25014 *maxim = i2c_get_clientdata(cl);
+
+ maxim->bl->props.brightness = 0;
+ max25014_update_status(maxim->bl);
+ if (maxim->enable)
+ gpiod_set_value_cansleep(maxim->enable, 0);
+ if (maxim->vin)
+ regulator_disable(maxim->vin);
+}
+
+static const struct of_device_id max25014_dt_ids[] = {
+ { .compatible = "maxim,max25014", },
+ { }
+};
+MODULE_DEVICE_TABLE(of, max25014_dt_ids);
+
+static const struct i2c_device_id max25014_ids[] = {
+ { "max25014" },
+ { }
+};
+MODULE_DEVICE_TABLE(i2c, max25014_ids);
+
+static struct i2c_driver max25014_driver = {
+ .driver = {
+ .name = KBUILD_MODNAME,
+ .of_match_table = of_match_ptr(max25014_dt_ids),
+ },
+ .probe = max25014_probe,
+ .remove = max25014_remove,
+ .id_table = max25014_ids,
+};
+module_i2c_driver(max25014_driver);
+
+MODULE_DESCRIPTION("Maxim MAX25014 backlight driver");
+MODULE_AUTHOR("Maud Spierings <maudspierings@gocontroll.com>");
+MODULE_LICENSE("GPL");
diff --git a/include/linux/platform_data/max25014.h b/include/linux/platform_data/max25014.h
new file mode 100644
index 0000000000000000000000000000000000000000..048f11015e9551e619ddec9167e3f10394f44bb9
--- /dev/null
+++ b/include/linux/platform_data/max25014.h
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Backlight driver for Maxim MAX25014
+ *
+ * Copyright (C) 2025 GOcontroll B.V.
+ * Author: Maud Spierings <maudspierings@gocontroll.com>
+ */
+
+#ifndef _MAX25014_H
+#define _MAX25014_H
+
+/**
+ * struct max25014_platform_data
+ * @initial_brightness : Initial value of the backlight brightness.
+ * @iset : Value of the iset field which scales the amperage/limits it.
+ * @strings : Which, out of four, led strings are in use.
+ */
+struct max25014_platform_data {
+ uint32_t initial_brightness;
+ uint32_t iset;
+ uint32_t strings[4];
+};
+
+#endif
--
2.50.1
^ permalink raw reply related
* [PATCH 0/4] backlight: add new max25014 backlight driver
From: Maud Spierings via B4 Relay @ 2025-07-25 11:09 UTC (permalink / raw)
To: Lee Jones, Daniel Thompson, Jingoo Han, Pavel Machek, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Helge Deller, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam
Cc: dri-devel, linux-leds, devicetree, linux-kernel, linux-fbdev, imx,
linux-arm-kernel, Maud Spierings,
"Maud Spierings maudspierings"
The Maxim MAX25014 is an automotive grade backlight driver IC. Its
datasheet can be found at [1].
With its integrated boost controller, it can power 4 channels (led
strings) and has a number of different modes using pwm and or i2c.
Currently implemented is only i2c control.
link: https://www.analog.com/media/en/technical-documentation/data-sheets/MAX25014.pdf [1]
Signed-off-by: Maud Spierings <maudspierings@gocontroll.com>
---
Maud Spierings (4):
dt-bindings: backlight: Add max25014 bindings
backlight: add max25014atg backlight
arm64: dts: freescale: moduline-display-av101hdt-a10: add backlight
arm64: dts: freescale: moduline-display-av123z7m-n17: add backlight
.../bindings/leds/backlight/maxim,max25014.yaml | 78 ++++
MAINTAINERS | 7 +
...x8p-ml81-moduline-display-106-av101hdt-a10.dtso | 21 +
...x8p-ml81-moduline-display-106-av123z7m-n17.dtso | 19 +-
drivers/video/backlight/Kconfig | 7 +
drivers/video/backlight/Makefile | 1 +
drivers/video/backlight/max25014.c | 449 +++++++++++++++++++++
include/linux/platform_data/max25014.h | 24 ++
8 files changed, 605 insertions(+), 1 deletion(-)
---
base-commit: d7af19298454ed155f5cf67201a70f5cf836c842
change-id: 20250626-max25014-4207591e1af5
Best regards,
--
Maud Spierings <maudspierings@gocontroll.com>
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox