xref: /aosp_15_r20/external/libwebsockets/lib/drivers/display/README.md (revision 1c60b9aca93fdbc9b5f19b2d2194c91294b22281)
1*1c60b9acSAndroid Build Coastguard Worker# lws_display
2*1c60b9acSAndroid Build Coastguard Worker
3*1c60b9acSAndroid Build Coastguard Workerlws provides a generic "display" object that is independent of the connection
4*1c60b9acSAndroid Build Coastguard Workerto the display, i2c and spi implementations are provided.
5*1c60b9acSAndroid Build Coastguard Worker
6*1c60b9acSAndroid Build Coastguard WorkerIts purpose is to provide basic blit, backlight binding to lws_pwm, backlight /
7*1c60b9acSAndroid Build Coastguard Workerpower management and display info like pixels wide and high in a generic way.
8*1c60b9acSAndroid Build Coastguard Worker
9*1c60b9acSAndroid Build Coastguard WorkerThe generic display object `lws_display_t` can be included at the top of a
10*1c60b9acSAndroid Build Coastguard Workerspecific display implementation object, eg, binding it to additional members
11*1c60b9acSAndroid Build Coastguard Workerto define the actual IO operations to be used, eg, i2c or spi.
12*1c60b9acSAndroid Build Coastguard Worker
13*1c60b9acSAndroid Build Coastguard WorkerWhen the display is instantiated, it allocates an additional structure on heap
14*1c60b9acSAndroid Build Coastguard Workerthat contains dynamic information about display state, `lws_display_state_t`.
15*1c60b9acSAndroid Build Coastguard Worker
16*1c60b9acSAndroid Build Coastguard Worker## Power state machine
17*1c60b9acSAndroid Build Coastguard Worker
18*1c60b9acSAndroid Build Coastguard Workerlws_display objects have convenient power state management using a single lws
19*1c60b9acSAndroid Build Coastguard Workersul event loop timer that is managed automatically.
20*1c60b9acSAndroid Build Coastguard Worker
21*1c60b9acSAndroid Build Coastguard WorkerState|Meaning
22*1c60b9acSAndroid Build Coastguard Worker---|---
23*1c60b9acSAndroid Build Coastguard WorkerOFF|The display is in sleep and not showing anything
24*1c60b9acSAndroid Build Coastguard WorkerBECOMING_ACTIVE|The display was asked to come out of sleep and is waiting for .latency_wake_ms befor proceeding to ACTIVE.  The backlight if any is off.  After the delay, the backlight is sequenced up to `.bl_active` using `.bl_transition` sequencer
25*1c60b9acSAndroid Build Coastguard WorkerACTIVE|The backlight is ON and the dim timer is running
26*1c60b9acSAndroid Build Coastguard WorkerAUTODIMMED|The dim timer was not told the display was active for `.autodim_ms`, we are at `.bl_dim` brightness.  After `.off_ms` we will transition to OFF
27*1c60b9acSAndroid Build Coastguard Worker
28*1c60b9acSAndroid Build Coastguard WorkerThe lws_pwm sequencers are used to provide customizable, smooth transitions for
29*1c60b9acSAndroid Build Coastguard Workerthe backlight, which may be nonlinear.
30*1c60b9acSAndroid Build Coastguard Worker
31*1c60b9acSAndroid Build Coastguard Worker## Active notification
32*1c60b9acSAndroid Build Coastguard Worker
33*1c60b9acSAndroid Build Coastguard WorkerCalling `lws_display_state_active(&lds)` on eg, user interaction causes the
34*1c60b9acSAndroid Build Coastguard Workerdisplay state to transition to ACTIVE smoothly, taking care of waking the display
35*1c60b9acSAndroid Build Coastguard Workerand waiting out a display-specific wake period, and sequencing the backlight
36*1c60b9acSAndroid Build Coastguard Workertransition to active level as specified in the display structure.
37