Exemple #1
0
int mainboard_smi_apmc(u8 apmc)
{
	printk(BIOS_DEBUG, "mainboard_smi_apmc: %x\n", apmc);
	switch (apmc) {
	case APMC_ACPI_EN:
		printk(BIOS_DEBUG, "APMC: ACPI_EN\n");
		/* Clear all pending events */
		/* EC cmd:59 data:E8 */
		ec_kbc_write_cmd(0x59);
		ec_kbc_write_ib(0xE8);

		/* Set LID GPI to generate SCIs */
		gpi_route_interrupt(EC_LID_GPI, GPI_IS_SCI);
		break;
	case APMC_ACPI_DIS:
		printk(BIOS_DEBUG, "APMC: ACPI_DIS\n");
		/* Clear all pending events */
		/* EC cmd:59 data:e9 */
		ec_kbc_write_cmd(0x59);
		ec_kbc_write_ib(0xE9);

		/* Set LID GPI to generate SMIs */
		gpi_route_interrupt(EC_LID_GPI, GPI_IS_SMI);
		break;
	}
	return 0;
}
Exemple #2
0
static u8 mainboard_smi_ec(void)
{
	u8 src;
#if CONFIG(ELOG_GSMI)
	static int battery_critical_logged;
#endif

	ec_kbc_write_cmd(0x56);
	src = ec_kbc_read_ob();
	printk(BIOS_DEBUG, "mainboard_smi_ec src: %x\n", src);

	switch (src) {
	case EC_BATTERY_CRITICAL:
#if CONFIG(ELOG_GSMI)
		if (!battery_critical_logged)
			elog_add_event_byte(ELOG_TYPE_EC_EVENT,
					    EC_EVENT_BATTERY_CRITICAL);
		battery_critical_logged = 1;
#endif
		break;
	case EC_LID_CLOSE:
		printk(BIOS_DEBUG, "LID CLOSED, SHUTDOWN\n");

#if CONFIG(ELOG_GSMI)
		elog_add_event_byte(ELOG_TYPE_EC_EVENT, EC_EVENT_LID_CLOSED);
#endif
		/* Go to S5 */
		write_pmbase32(PM1_CNT, read_pmbase32(PM1_CNT) | (0xf << 10));
		break;
	}

	return src;
}
Exemple #3
0
u8 ec_it8518_get_event(void)
{
	u8 cmd = 0;
	u8 status = inb(EC_SC);
	if (status & SCI_EVT) 	{
		ec_write_cmd(QR_EC);
		cmd = ec_read_ob();
	} else if ( status & SMI_EVT) {
		ec_kbc_write_cmd(EC_KBD_SMI_EVENT);
		cmd = ec_kbc_read_ob();
	}
	return cmd;
}
Exemple #4
0
void mainboard_smi_sleep(u8 slp_typ)
{
	printk(BIOS_DEBUG, "mainboard_smi_sleep: %x\n", slp_typ);
	/* Disable SCI and SMI events */


	/* Clear pending events that may trigger immediate wake */


	/* Enable wake events */


	/* Tell the EC to Disable USB power */
	if (smm_get_gnvs()->s3u0 == 0 && smm_get_gnvs()->s3u1 == 0) {
		ec_kbc_write_cmd(0x45);
		ec_kbc_write_ib(0xF2);
	}
}
Exemple #5
0
void parrot_ec_init(void)
{
	printk(BIOS_DEBUG, "Parrot EC Init\n");

	/* Clean up the buffers. We don't know the initial condition. */
	kbc_cleanup_buffers();

	/* Report EC info */
	/* EC version: cmd 0x51 - returns three bytes */
	ec_kbc_write_cmd(0x51);
	printk(BIOS_DEBUG,"  EC version %x.%x.%x\n",
		   ec_kbc_read_ob(), ec_kbc_read_ob(), ec_kbc_read_ob());

	/* EC Project name: cmd 0x52, 0xA0 - returns five bytes */
	ec_kbc_write_cmd(0x52);
	ec_kbc_write_ib(0xA0);
	printk(BIOS_DEBUG,"  EC Project: %c%c%c%c%c\n",
		   ec_kbc_read_ob(),ec_kbc_read_ob(),ec_kbc_read_ob(),
		   ec_kbc_read_ob(), ec_kbc_read_ob());

	/* Print the hardware revision */
	printk(BIOS_DEBUG,"  Parrot Revision %x\n", parrot_rev());

	/* US Keyboard */
	ec_kbc_write_cmd(0x59);
	ec_kbc_write_ib(0xE5);

	/* Enable IRQ1 */
	ec_kbc_write_cmd(0x59);
	ec_kbc_write_ib(0xD1);

	/* TODO - Do device detection and device maintain state (nvs) */
	/* Enable Wireless and Bluetooth */
	ec_kbc_write_cmd(0x45);
	ec_kbc_write_ib(0xAD);

	/* Set Wireless and Bluetooth Available */
	ec_kbc_write_cmd(0x45);
	ec_kbc_write_ib(0xA8);

	/* Set Wireless and Bluetooth Enable */
	ec_kbc_write_cmd(0x45);
	ec_kbc_write_ib(0xA2);
}
Exemple #6
0
/* The keyboard matrix tells the EC how the keyboard is wired internally */
static void set_keyboard_matrix_us(void)
{
	ec_kbc_write_cmd(0x59);
	ec_kbc_write_ib(0xE5);
}
Exemple #7
0
/* Tell EC to operate in APM mode. Events generate SMIs instead of SCIs */
static void enter_apm_mode(void)
{
	ec_kbc_write_cmd(0x59);
	ec_kbc_write_ib(0xE9);
}
Exemple #8
0
/* Parrot Hardware Revision */
u8 parrot_rev(void)
{
	ec_kbc_write_cmd(0x45);
	ec_kbc_write_ib(0x40);
	return ec_kbc_read_ob();
}