view src/cs/drivers/drv_app/r2d/lcds/luna/r2d_onoff_i.c @ 276:4221c724c664

R2D: preparations for adding LCD hardware suspend handling
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 07 Sep 2021 21:05:38 +0000
parents 6541e43f88e5
children 0196b6bf633c
line wrap: on
line source

#include "r2d/lcds/luna/r2d_luna_lcd.h"
#include "main/sys_types.h"
#include "armio.h"

static void r2d_onoff_action(enum blrr_display_state set_state)
{
	UBYTE on_off;

	/*
	 * PWL control: on our current Luna setups (Caramel2 or iWOW DSK)
	 * PWL is only an indicator LED for developers, but the Mother's
	 * plan for the dream FreeCalypso handset includes having PWL
	 * regulate the backlight intensity.
	 */
	switch (set_state) {
	case BLRR_DISPLAY_OFF:
		*(volatile SYS_UWORD8 *)0xFFFE8000 = 0;
		*(volatile SYS_UWORD8 *)0xFFFE8001 = 0;
		on_off = 0;
		break;
	case BLRR_DISPLAY_ON:
		*(volatile SYS_UWORD8 *)0xFFFE8000 = 255;
		*(volatile SYS_UWORD8 *)0xFFFE8001 = 1;
		on_off = 1;
		break;
	case BLRR_DISPLAY_INCALL:
		*(volatile SYS_UWORD8 *)0xFFFE8000 = 16;
		*(volatile SYS_UWORD8 *)0xFFFE8001 = 1;
		on_off = 1;
		break;
	case BLRR_DISPLAY_CHG_BOOT:
		*(volatile SYS_UWORD8 *)0xFFFE8000 = 64;
		*(volatile SYS_UWORD8 *)0xFFFE8001 = 1;
		on_off = 1;
		break;
	default:
		return;		/* error, but we are a void function */
	}
	/* physical backlight on/off */
	if (on_off)
		AI_SetBit(9);
	else
		AI_ResetBit(9);
	/* TFT on/off control remains to be implemented */
}