Thanks Alan,

As per usual, the obvious escaped me - a character driver makes sense of course. I will implement this, for now, as a board-specific driver and when its working, and I have time, I will look at transitioning it to be a generic NuttX driver.

On 03/01/2024 20:17, Alan C. Assis wrote:
Hi Tim,

AFAIK NuttX doesn't have a standard way to do it.
It is normally done at board level (do a "git grep backlight" inside
boards/ to see some examples).

A proper way to do that should be implementing a backlight subsystem, like
a subset of Linux backlight subsystem:
https://docs.kernel.org/gpu/backlight.html

I think you could create a simple char device driver (at
drivers/lcd/backlight.c) that will receive IOCTLs to set the backlight
dimming.

Best Regards,

Alan


On Wed, Jan 3, 2024 at 3:03 PM Tim Hardisty <timhardist...@gmail.com> wrote:

My SAMA5 board has an LCD with variable brightness (pwm controlled).

arch/arm/src/chip/sam_lcd.c has a function called "sam_backlight) that
takes a level value, but it appears to be local to that file, and the
only call to it is in the LCD init functions in that file, complete with
a comment that says:

     /REVISIT: Backlight level could be dynamically adjustable/

That's what I need.

But from an app perspective I can't get my mind around what the right
function call would be to ripple that down to something low level and
board specific. So if I change the processor, for example, the app will
still work and not rely (for example) on board ioctls.

Can someone point me in the direction of the "right" way to handle this,
please? Once I know the "flow" I can work out how and where it is best
to expose the right function.

Thanks!


Reply via email to