ec/dasharo/ec: add Dasharo features

- Setting battery thresholds
- PEP hooks for S0ix
- Remove unused keyboard backlight, OLED, FCMD, ACPI power button device

Change-Id: I5600487afcb0a4b261d9ff85e3b2c73535a23f3d
Signed-off-by: Michał Kopeć <michal.kopec@3mdeb.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/82672
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Krystian Hebel <krystian.hebel@3mdeb.com>
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
This commit is contained in:
Michał Kopeć 2024-05-21 10:20:49 +02:00 committed by Felix Singer
commit aeb5ccd129
14 changed files with 299 additions and 329 deletions

View file

@ -1,6 +1,7 @@
## SPDX-License-Identifier: GPL-2.0-only
config EC_DASHARO_EC
select EC_ACPI
bool
help
Dasharo EC
@ -15,7 +16,16 @@ config EC_DASHARO_EC_DGPU
bool
default n
config EC_DASHARO_EC_OLED
config EC_DASHARO_EC_UPDATE
depends on EC_DASHARO_EC
bool
bool "Update the embedded controller firmware"
default n
config EC_DASHARO_EC_UPDATE_FILE
depends on EC_DASHARO_EC_UPDATE
string "Path to the EC update file"
default "ec.rom"
config EC_DASHARO_EC_FLASH_SIZE
hex
default 0x20000

View file

@ -1,10 +1,9 @@
## SPDX-License-Identifier: GPL-2.0-only
# SPDX-License-Identifier: GPL-2.0-only
ifeq ($(CONFIG_EC_DASHARO_EC),y)
all-y += dasharo_ec.c
ramstage-y += smbios.c
all-y += buttons.c
smm-$(CONFIG_DEBUG_SMI) += dasharo_ec.c
endif

24
src/ec/dasharo/ec/acpi.h Normal file
View file

@ -0,0 +1,24 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef EC_DASHARO_EC_ACPI_H
#define EC_DASHARO_EC_ACPI_H
#include <ec/acpi/ec.h>
#define DASHARO_EC_REG_LSTE 0x03
#define DASHARO_EC_REG_LSTE_LID_STATE 0x01
#define DASHARO_EC_REG_BATTERY_START_THRESHOLD 0xBC
#define DASHARO_EC_REG_BATTERY_STOP_THRESHOLD 0xBD
int dasharo_ec_get_lid_state(void);
enum bat_threshold_type {
BAT_THRESHOLD_START,
BAT_THRESHOLD_STOP
};
int dasharo_ec_get_bat_threshold(enum bat_threshold_type type);
void dasharo_ec_set_bat_threshold(enum bat_threshold_type type, uint8_t value);
#endif /* EC_DASHARO_EC_ACPI_H */

View file

@ -1,11 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0-only */
Device (PWRB)
{
Name (_HID, EisaId ("PNP0C0C"))
Name (_PRW, Package () { EC_GPE_SWI, 3 })
}
Device (SLPB)
{
Name (_HID, EisaId ("PNP0C0E"))

View file

@ -0,0 +1,83 @@
/* SPDX-License-Identifier: GPL-2.0-only */
Device (DASH) {
Name (_HID, "DSHR4543")
Name (_UID, 0)
// Hide the device so that Windows does not warn about a missing driver.
Name (_STA, 0xB)
Method (INIT, 0, Serialized) {
Printf ("DASH: INIT")
If (^^PCI0.LPCB.EC0.ECOK) {
// Set flags to use software control
^^PCI0.LPCB.EC0.ECOS = 2
Return (0)
} Else {
Return (1)
}
}
Method (FINI, 0, Serialized) {
Printf ("DASH: FINI")
If (^^PCI0.LPCB.EC0.ECOK) {
// Set flags to use hardware control
^^PCI0.LPCB.EC0.ECOS = 1
Return (0)
} Else {
Return (1)
}
}
// Fan names
Method (NFAN, 0, Serialized) {
Return (Package() {
"CPU fan",
#if CONFIG(EC_DASHARO_EC_DGPU)
"GPU fan",
#endif
})
}
// Get fan duty cycle and RPM as a single value
Method (GFAN, 1, Serialized) {
Local0 = 0
Local1 = 0
If (^^PCI0.LPCB.EC0.ECOK) {
If (Arg0 == 0) {
Local0 = ^^PCI0.LPCB.EC0.DUT1
Local1 = ^^PCI0.LPCB.EC0.RPM1
} ElseIf (Arg0 == 1) {
Local0 = ^^PCI0.LPCB.EC0.DUT2
Local1 = ^^PCI0.LPCB.EC0.RPM2
}
}
If (Local1 != 0) {
// 60 * (EC frequency / 120) / 2
Local1 = 2156250 / Local1
}
Return ((Local1 << 8) | Local0)
}
// Temperature names
Method (NTMP, 0, Serialized) {
Return (Package() {
"CPU temp",
#if CONFIG(EC_DASHARO_EC_DGPU)
"GPU temp",
#endif
})
}
// Get temperature
Method (GTMP, 1, Serialized) {
Local0 = 0;
If (^^PCI0.LPCB.EC0.ECOK) {
If (Arg0 == 0) {
Local0 = ^^PCI0.LPCB.EC0.TMP1
} ElseIf (Arg0 == 1) {
Local0 = ^^PCI0.LPCB.EC0.TMP2
}
}
Return (Local0)
}
}

View file

@ -6,7 +6,7 @@ Scope (\_SB) {
#include "buttons.asl"
#include "hid.asl"
#include "lid.asl"
#include "s76.asl"
#include "dasharo.asl"
}
Device (\_SB.PCI0.LPCB.EC0)
@ -36,7 +36,7 @@ Device (\_SB.PCI0.LPCB.EC0)
{
Printf ("EC: _REG %o %o", ToHexString(Arg0), ToHexString(Arg1))
If ((Arg0 == 0x03) && (Arg1 == 1)) {
// Enable hardware touchpad lock, airplane mode, and keyboard backlight keys
// Enable hardware touchpad lock and airplane mode keys
ECOS = 1
// Enable software display brightness keys
@ -56,9 +56,6 @@ Device (\_SB.PCI0.LPCB.EC0)
// EC is now available
ECOK = Arg1
// Reset Dasharo Device
^^^^S76D.RSET()
}
}
@ -93,6 +90,20 @@ Device (\_SB.PCI0.LPCB.EC0)
}
}
Method (S0IX, 1, Serialized) {
Printf ("EC: S0ix hook")
If (ECOK) {
S0XH = Arg0
}
}
Method (EDSX, 1, Serialized) {
Printf ("EC: Display hook")
If (ECOK) {
DSPH = Arg0
}
}
Method (_Q0A, 0, NotSerialized) // Touchpad Toggle
{
Printf ("EC: Touchpad Toggle")
@ -101,9 +112,6 @@ Device (\_SB.PCI0.LPCB.EC0)
Method (_Q0B, 0, NotSerialized) // Screen Toggle
{
Printf ("EC: Screen Toggle")
#if CONFIG(EC_DASHARO_EC_OLED)
Notify (^^^^S76D, 0x85)
#endif // CONFIG(EC_DASHARO_EC_OLED)
}
Method (_Q0C, 0, NotSerialized) // Mute
@ -111,11 +119,6 @@ Device (\_SB.PCI0.LPCB.EC0)
Printf ("EC: Mute")
}
Method (_Q0D, 0, NotSerialized) // Keyboard Backlight
{
Printf ("EC: Keyboard Backlight")
}
Method (_Q0E, 0, NotSerialized) // Volume Down
{
Printf ("EC: Volume Down")
@ -209,30 +212,12 @@ Device (\_SB.PCI0.LPCB.EC0)
Method (_Q1D, 0, NotSerialized) // Power Button
{
Printf ("EC: Power Button")
Notify (PWRB, 0x80)
}
Method (_Q50, 0, NotSerialized) // Other Events
{
Local0 = OEM4
If (Local0 == 0x8A) {
Printf ("EC: White Keyboard Backlight")
Notify (^^^^S76D, 0x80)
} ElseIf (Local0 == 0x9F) {
Printf ("EC: Color Keyboard Toggle")
Notify (^^^^S76D, 0x81)
} ElseIf (Local0 == 0x81) {
Printf ("EC: Color Keyboard Down")
Notify (^^^^S76D, 0x82)
} ElseIf (Local0 == 0x82) {
Printf ("EC: Color Keyboard Up")
Notify (^^^^S76D, 0x83)
} ElseIf (Local0 == 0x80) {
Printf ("EC: Color Keyboard Color Change")
Notify (^^^^S76D, 0x84)
} Else {
Printf ("EC: Other: %o", ToHexString(Local0))
}
Printf ("EC: Other: %o", ToHexString(Local0))
}
#if CONFIG(EC_DASHARO_EC_BAT_THRESHOLDS)

View file

@ -45,11 +45,7 @@ Field (ERAM, ByteAcc, Lock, Preserve)
Offset (0xD9),
AIRP, 8, // Airplane mode LED
WINF, 8, // Enable ACPI brightness controls
Offset (0xF8),
FCMD, 8,
FDAT, 8,
FBUF, 8,
FBF1, 8,
FBF2, 8,
FBF3, 8,
Offset (0xE0),
S0XH, 1, // S0ix hook
DSPH, 1, // Display hook
}

View file

@ -6,16 +6,16 @@ Device (LID0)
Name (_PRW, Package () { EC_GPE_SWI, 3 })
Method (_LID, 0, NotSerialized) {
Printf ("LID: _LID")
DEBUG = "LID: _LID"
If (^^PCI0.LPCB.EC0.ECOK) {
Return (^^PCI0.LPCB.EC0.LSTE)
} Else {
Return (1)
Return (One)
}
}
Method (_PSW, 1, NotSerialized) {
Printf ("LID: _PSW: %o", ToHexString(Arg0))
DEBUG = Concatenate("LID: _PSW: ", ToHexString(Arg0))
If (^^PCI0.LPCB.EC0.ECOK) {
^^PCI0.LPCB.EC0.LWKE = Arg0
}

View file

@ -1,178 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
// Notifications:
// 0x80 - hardware backlight toggle
// 0x81 - backlight toggle
// 0x82 - backlight down
// 0x83 - backlight up
// 0x84 - backlight color change
// 0x85 - OLED screen toggle
Device (S76D) {
Name (_HID, "17761776")
Name (_UID, 0)
// Hide the device so that Windows does not warn about a missing driver.
Name (_STA, 0xB)
Method (RSET, 0, Serialized) {
Printf ("S76D: RSET")
SAPL(0)
SKBB(0)
SKBC(0xFFFFFF)
}
Method (INIT, 0, Serialized) {
Printf ("S76D: INIT")
RSET()
If (^^PCI0.LPCB.EC0.ECOK) {
// Set flags to use software control
^^PCI0.LPCB.EC0.ECOS = 2
Return (0)
} Else {
Return (1)
}
}
Method (FINI, 0, Serialized) {
Printf ("S76D: FINI")
RSET()
If (^^PCI0.LPCB.EC0.ECOK) {
// Set flags to use hardware control
^^PCI0.LPCB.EC0.ECOS = 1
Return (0)
} Else {
Return (1)
}
}
// Get Airplane LED
Method (GAPL, 0, Serialized) {
If (^^PCI0.LPCB.EC0.ECOK) {
If (^^PCI0.LPCB.EC0.AIRP & 0x40) {
Return (1)
}
}
Return (0)
}
// Set Airplane LED
Method (SAPL, 1, Serialized) {
If (^^PCI0.LPCB.EC0.ECOK) {
If (Arg0) {
^^PCI0.LPCB.EC0.AIRP |= 0x40
} Else {
^^PCI0.LPCB.EC0.AIRP &= 0xBF
}
}
}
// Get Keyboard Backlight Kind
// 0 - No backlight
// 1 - White backlight
// 2 - RGB backlight
Method (GKBK, 0, Serialized) {
Local0 = 0
If (^^PCI0.LPCB.EC0.ECOK) {
^^PCI0.LPCB.EC0.FDAT = 2
^^PCI0.LPCB.EC0.FCMD = 0xCA
Local0 = ^^PCI0.LPCB.EC0.FBUF
}
Return (Local0)
}
// Get Keyboard Brightness
Method (GKBB, 0, Serialized) {
Local0 = 0
If (^^PCI0.LPCB.EC0.ECOK) {
^^PCI0.LPCB.EC0.FDAT = 1
^^PCI0.LPCB.EC0.FCMD = 0xCA
Local0 = ^^PCI0.LPCB.EC0.FBUF
}
Return (Local0)
}
// Set Keyboard Brightness
Method (SKBB, 1, Serialized) {
If (^^PCI0.LPCB.EC0.ECOK) {
^^PCI0.LPCB.EC0.FDAT = 0
^^PCI0.LPCB.EC0.FBUF = Arg0
^^PCI0.LPCB.EC0.FCMD = 0xCA
}
}
// Get Keyboard Color
Method (GKBC, 0, Serialized) {
Local0 = 0
If (^^PCI0.LPCB.EC0.ECOK) {
^^PCI0.LPCB.EC0.FDAT = 4
^^PCI0.LPCB.EC0.FCMD = 0xCA
Local0 = ^^PCI0.LPCB.EC0.FBUF
Local0 |= (^^PCI0.LPCB.EC0.FBF1) << 16
Local0 |= (^^PCI0.LPCB.EC0.FBF2) << 8
}
Return (Local0)
}
// Set Keyboard Color
Method (SKBC, 1, Serialized) {
If (^^PCI0.LPCB.EC0.ECOK) {
^^PCI0.LPCB.EC0.FDAT = 3
^^PCI0.LPCB.EC0.FBUF = (Arg0 & 0xFF)
^^PCI0.LPCB.EC0.FBF1 = ((Arg0 >> 16) & 0xFF)
^^PCI0.LPCB.EC0.FBF2 = ((Arg0 >> 8) & 0xFF)
^^PCI0.LPCB.EC0.FCMD = 0xCA
}
}
// Fan names
Method (NFAN, 0, Serialized) {
Return (Package() {
"CPU fan",
#if CONFIG(EC_DASHARO_EC_DGPU)
"GPU fan",
#endif
})
}
// Get fan duty cycle and RPM as a single value
Method (GFAN, 1, Serialized) {
Local0 = 0
Local1 = 0
If (^^PCI0.LPCB.EC0.ECOK) {
If (Arg0 == 0) {
Local0 = ^^PCI0.LPCB.EC0.DUT1
Local1 = ^^PCI0.LPCB.EC0.RPM1
} ElseIf (Arg0 == 1) {
Local0 = ^^PCI0.LPCB.EC0.DUT2
Local1 = ^^PCI0.LPCB.EC0.RPM2
}
}
If (Local1 != 0) {
// 60 * (EC frequency / 120) / 2
Local1 = 2156250 / Local1
}
Return ((Local1 << 8) | Local0)
}
// Temperature names
Method (NTMP, 0, Serialized) {
Return (Package() {
"CPU temp",
#if CONFIG(EC_DASHARO_EC_DGPU)
"GPU temp",
#endif
})
}
// Get temperature
Method (GTMP, 1, Serialized) {
Local0 = 0;
If (^^PCI0.LPCB.EC0.ECOK) {
If (Arg0 == 0) {
Local0 = ^^PCI0.LPCB.EC0.TMP1
} ElseIf (Arg0 == 1) {
Local0 = ^^PCI0.LPCB.EC0.TMP2
}
}
Return (Local0)
}
}

View file

@ -0,0 +1,15 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <ec/acpi/ec.h>
#include "acpi.h"
/**
* Return the state of lid switch.
*
* @return 1 if the lid is open.
*/
int dasharo_ec_get_lid_state(void)
{
return ec_read(DASHARO_EC_REG_LSTE) & DASHARO_EC_REG_LSTE_LID_STATE;
}

View file

@ -0,0 +1,87 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <stdint.h>
// SMFI commands
// Indicates that EC is ready to accept commands
#define CMD_NONE 0
// Probe for Dasharo EC protocol
#define CMD_PROBE 1
// Read board string
#define CMD_BOARD 2
// Read version string
#define CMD_VERSION 3
// Write bytes to console
#define CMD_PRINT 4
// Access SPI chip
#define CMD_SPI 5
// Reset EC
#define CMD_RESET 6
// Get fan speeds
#define CMD_FAN_GET 7
// Set fan speeds
#define CMD_FAN_SET 8
// Get keyboard map index
#define CMD_KEYMAP_GET 9
// Set keyboard map index
#define CMD_KEYMAP_SET 10
// Get LED value by index
#define CMD_LED_GET_VALUE 11
// Set LED value by index
#define CMD_LED_SET_VALUE 12
// Get LED color by index
#define CMD_LED_GET_COLOR 13
// Set LED color by index
#define CMD_LED_SET_COLOR 14
// Get LED matrix mode and speed
#define CMD_LED_GET_MODE 15
// Set LED matrix mode and speed
#define CMD_LED_SET_MODE 16
// Get key matrix state
#define CMD_MATRIX_GET 17
// Save LED settings to ROM
#define CMD_LED_SAVE 18
// Enable/disable no input mode
#define CMD_SET_NO_INPUT 19
// Set fan curve
#define CMD_FAN_CURVE_SET 20
// Get security state
#define CMD_SECURITY_GET 21,
// Set security state
#define CMD_SECURITY_SET 22,
// Set camera enablement
#define CMD_CAMERA_ENABLEMENT_SET 23
// Set WiFi + Bluetooth card enablement
#define CMD_WIFI_BT_ENABLEMENT_SET 24
// Get a persistent option by index
#define CMD_OPTION_GET 25
// Set a persistent option by index
#define CMD_OPTION_SET 26
// Print command. Registers are unique for each command
#define CMD_PRINT_REG_FLAGS 2
#define CMD_PRINT_REG_LEN 3
#define CMD_PRINT_REG_DATA 4
// SPI command
// Read from SPI chip if set, write otherwise
#define CMD_SPI_FLAG_READ BIT(0)
// Disable SPI chip after executing command
#define CMD_SPI_FLAG_DISABLE BIT(1)
// Run firmware from scratch RAM if necessary
#define CMD_SPI_FLAG_SCRATCH BIT(2)
// Write to backup ROM instead
#define CMD_SPI_FLAG_BACKUP BIT(3)
#define CMD_LED_INDEX_ALL 0xFF
// Persistent option definitions
enum {
OPT_POWER_ON_AC = 0,
NUM_OPTIONS
};
uint8_t dasharo_ec_smfi_cmd(uint8_t cmd, uint8_t len, uint8_t *data);
uint8_t dasharo_ec_read_version(uint8_t *data);
uint8_t dasharo_ec_read_board(uint8_t *data);

View file

@ -1,31 +1,30 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include "dasharo_ec.h"
#include <bootstate.h>
#include <arch/io.h>
#include <console/dasharo_ec.h>
#include <console/console.h>
#include <cbfs.h>
#include <console/system76_ec.h>
#include <pc80/mc146818rtc.h>
#include <security/vboot/misc.h>
#include <security/vboot/vboot_common.h>
#include <timer.h>
#include "acpi.h"
#include "commands.h"
// This is the command region for Dasharo EC firmware. It must be
// enabled for LPC in the mainboard.
#define DASHARO_EC_BASE 0x0E00
#define DASHARO_EC_SIZE 256
#define REG_CMD 0
#define SPI_SECTOR_SIZE 1024
#define REG_CMD 0
#define REG_RESULT 1
#define REG_DATA 2 // Start of command data
#define REG_DATA 2 // Start of command data
// When command register is 0, command is complete
#define CMD_FINISHED 0
#define RESULT_OK 0
// Print command. Registers are unique for each command
#define CMD_PRINT 4
#define CMD_PRINT_REG_FLAGS 2
#define CMD_PRINT_REG_LEN 3
#define CMD_PRINT_REG_DATA 4
static inline uint8_t dasharo_ec_read(uint8_t addr)
{
return inb(DASHARO_EC_BASE + (uint16_t)addr);
@ -36,77 +35,59 @@ static inline void dasharo_ec_write(uint8_t addr, uint8_t data)
outb(data, DASHARO_EC_BASE + (uint16_t)addr);
}
void dasharo_ec_init(void)
uint8_t dasharo_ec_smfi_cmd(uint8_t cmd, uint8_t len, uint8_t *data)
{
// Clear entire command region
for (int i = 0; i < DASHARO_EC_SIZE; i++)
dasharo_ec_write((uint8_t)i, 0);
}
int i;
void dasharo_ec_flush(void)
{
dasharo_ec_write(REG_CMD, CMD_PRINT);
if (len > DASHARO_EC_SIZE - REG_DATA)
return -1;
// Wait for command completion, for up to 10 milliseconds, with a
// Wait for previous command completion, for up to 10 milliseconds, with a
// test period of 1 microsecond
wait_us(10000, dasharo_ec_read(REG_CMD) == CMD_FINISHED);
dasharo_ec_write(CMD_PRINT_REG_LEN, 0);
}
// Write data first
for (i = 0; i < len; ++i)
dasharo_ec_write(REG_DATA + i, data[i]);
void dasharo_ec_print(uint8_t byte)
{
uint8_t len = dasharo_ec_read(CMD_PRINT_REG_LEN);
dasharo_ec_write(CMD_PRINT_REG_DATA + len, byte);
dasharo_ec_write(CMD_PRINT_REG_LEN, len + 1);
// If we hit the end of the buffer, or were given a newline, flush
if (byte == '\n' || len >= (DASHARO_EC_SIZE - CMD_PRINT_REG_DATA))
dasharo_ec_flush();
}
bool dasharo_ec_cmd(uint8_t cmd, const uint8_t *request_data,
uint8_t request_size, uint8_t *reply_data, uint8_t reply_size)
{
if (request_size > DASHARO_EC_SIZE - REG_DATA ||
reply_size > DASHARO_EC_SIZE - REG_DATA) {
printk(BIOS_ERR, "EC command %d too long - request size %u, reply size %u\n",
cmd, request_size, reply_size);
return false;
}
/* If any data were buffered by dasharo_ec_print(), flush it first */
uint8_t buffered_len = dasharo_ec_read(CMD_PRINT_REG_LEN);
if (buffered_len > 0)
dasharo_ec_flush();
/* Write the data */
uint8_t i;
for (i = 0; i < request_size; ++i)
dasharo_ec_write(REG_DATA + i, request_data[i]);
/* Write the command */
// Write command register, which starts command
dasharo_ec_write(REG_CMD, cmd);
/* Wait for the command to complete */
bool ret = true;
int elapsed = wait_ms(1000, dasharo_ec_read(REG_CMD) == CMD_FINISHED);
if (elapsed == 0) {
/* Timed out: fail the command, don't attempt to read a reply. */
printk(BIOS_WARNING, "EC command %d timed out - request size %d, reply size %d\n",
cmd, request_size, reply_size);
ret = false;
} else {
/* Read the reply */
for (i = 0; i < reply_size; ++i)
reply_data[i] = dasharo_ec_read(REG_DATA+i);
/* Check the reply status */
ret = (dasharo_ec_read(REG_RESULT) == RESULT_OK);
}
// Wait for previous command completion, for up to 10 milliseconds, with a
// test period of 1 microsecond
wait_us(10000, dasharo_ec_read(REG_CMD) == CMD_FINISHED);
/* Reset the flags and length so we can buffer console prints again */
dasharo_ec_write(CMD_PRINT_REG_FLAGS, 0);
dasharo_ec_write(CMD_PRINT_REG_LEN, 0);
return dasharo_ec_read(REG_RESULT);
}
int dasharo_ec_get_bat_threshold(enum bat_threshold_type type)
{
int ret = -1;
switch (type) {
case BAT_THRESHOLD_START:
ret = ec_read(DASHARO_EC_REG_BATTERY_START_THRESHOLD);
break;
case BAT_THRESHOLD_STOP:
ret = ec_read(DASHARO_EC_REG_BATTERY_STOP_THRESHOLD);
break;
default:
break;
}
return ret;
}
void dasharo_ec_set_bat_threshold(enum bat_threshold_type type, uint8_t value)
{
switch (type) {
case BAT_THRESHOLD_START:
ec_write(DASHARO_EC_REG_BATTERY_START_THRESHOLD, value);
break;
case BAT_THRESHOLD_STOP:
ec_write(DASHARO_EC_REG_BATTERY_STOP_THRESHOLD, value);
break;
default:
break;
}
}

View file

@ -1,17 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef DASHARO_EC_H
#define DASHARO_EC_H
#include <stdbool.h>
#include <stdint.h>
/*
* Send a command to the EC. request_data/request_size are the request payload,
* request_data can be NULL if request_size is 0. reply_data/reply_size are
* the reply payload, reply_data can be NULL if reply_size is 0.
*/
bool dasharo_ec_cmd(uint8_t cmd, const uint8_t *request_data,
uint8_t request_size, uint8_t *reply_data, uint8_t reply_size);
#endif

View file

@ -1,9 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <smbios.h>
smbios_wakeup_type smbios_system_wakeup_type(void)
{
// TODO: Read wake source from EC.
return SMBIOS_WAKEUP_TYPE_POWER_SWITCH;
}