Actually, it only works in a binary fashion:
- setBrightness(0): screen is off
- setBrightness(x) with x > 0: screen is on with full brightness
The reason is that the LEDC controlling GPIO pin 40 sets the VCI_EN pin, enabling the display when level is above 0.
To control the brightness of the screen, one needs to use SH8601 commands 0x51 (set brightness), 0x63 (set HBM brightness) and 0x66 (set HBM mode).
This should be done from within the SH8601 driver since it requires knowledge of how to send commands to the chip (using esp_lcd_panel_io_tx_param() directly does not work in QSPI mode, the command value has to be modified by ORing (LCD_OPCODE_WRITE_CMD << 24).